public interface Flyable
{
void fly();
}
public interface EggLayable
{
void egglay();
}
public interface Tweetable
{
void tweet();
}
using UnityEngine;
public class FlyAbility : Flyable
{
public void fly()
{
Debug.LogError("Fly");
}
}
using UnityEngine;
public class EggAbility : EggLayable
{
public void egglay()
{
Debug.LogError("egglay");
}
}
using UnityEngine;
public class TweetAbility : Tweetable
{
public void tweet()
{
Debug.LogError("tweet");
}
}
using UnityEngine;
public class Ostrich : MonoBehaviour,Tweetable,EggLayable
{
private TweetAbility m_TweetAbility = new TweetAbility();
private EggAbility m_EggAbility = new EggAbility();
public void tweet()
{
m_TweetAbility.tweet();
}
public void egglay()
{
m_EggAbility.egglay();
}
}