예제 #1
0
    public void SpawnBird(BirdType _type, Direction _dir, int _count)
    {
        GameObject _BirdModel = _regularBird;

        switch (_type)
        {
        case BirdType.Regular:
            _BirdModel = _regularBird;
            break;

        case BirdType.Fast:
            _BirdModel = _fastBird;
            break;

        case BirdType.Big:
            _BirdModel = _bigBird;
            break;
        }

        switch (_dir)
        {
        case Direction.Horizontal:
            StartCoroutine(SpawnWavesHorizontal(_BirdModel, _count));
            break;

        case Direction.Vertical:
            StartCoroutine(SpawnWavesVertical(_BirdModel, _count));
            break;

        case Direction.Diagonal:
            StartCoroutine(SpawnWavesDiagonal(_BirdModel, _count));
            break;
        }
    }
예제 #2
0
 /// <summary>
 /// WoodPecker constructor, passed to it is the property values
 /// This constructor calls the bird constructor (as a WoodPecker is a bird)
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="age">Age</param>
 /// <param name="gender">Gender</param>
 /// <param name="typeOfBird">As marchsandpiper is a bird, type of bird needs to be passed</param>
 /// <param name="typeOfBeak">This is a marchsandpiper property</param>
 public WoodPecker(string name, int age, Gender gender, BirdType typeOfBird, BeakType typeOfBeak) : base(name, age, gender, typeOfBird)
 {
     foodSchedule = new FoodSchedule();
     foodSchedule.Add("Tree insects once a day.");
     foodSchedule.Add("Tree liters of water once a week");
     TypeOfBeak = typeOfBeak;
 }
예제 #3
0
    void SpawnBird(BirdType birdType)
    {
        Vector3    spawnPos = Vector3.zero;
        Quaternion spawnRot = Quaternion.identity;

        if (birdType.prefab.name == "SimpleBird")
        {
            spawnPos   = Random.onUnitSphere * GameManager.Instance.worldRadius;
            spawnPos.y = Mathf.Abs(spawnPos.y);
            spawnRot   = Quaternion.LookRotation(Vector3.zero - spawnPos, Vector3.up);
        }
        else if (birdType.prefab.name == "TurdBird")
        {
            float   height = birdType.prefab.GetComponent <TurdBird>().height;
            Vector3 temp   = Random.insideUnitCircle.normalized * GameManager.Instance.worldRadius;
            spawnPos = new Vector3(temp.x, height, temp.y);
            spawnRot = Quaternion.LookRotation(new Vector3(0, height, 0) - spawnPos, Vector3.up);
        }
        else if (birdType.prefab.name == "Swoopy")
        {
            float   height = birdType.prefab.GetComponent <SwoopBird>().height;
            Vector3 temp   = Random.insideUnitCircle.normalized * GameManager.Instance.worldRadius;
            spawnPos = new Vector3(temp.x, height, temp.y);
            spawnRot = Quaternion.LookRotation(new Vector3(0, height, 0) - spawnPos, Vector3.up);
        }

        Instantiate(birdType.prefab, spawnPos, spawnRot);
        _wave.lastSpawn = _wave.timer;
        aliveBirds++;
    }
예제 #4
0
 /// <summary>
 /// MarchSandpiper constructor, passed to it is the property values
 /// This constructor calls the bird constructor (as a MarchSandpiper is a bird)
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="age">Age</param>
 /// <param name="gender">Gender</param>
 /// <param name="typeOfBird">As marchsandpiper is a bird, type of bird needs to be passed</param>
 /// <param name="wingSpan">This is a marchsandpiper property</param>
 /// <param name="plumage">This is a marchsandpiper property</param>
 public MarchSandpiper(string name, int age, Gender gender, BirdType typeOfBird, int wingSpan, Plumage plumage) : base(name, age, gender, typeOfBird)
 {
     foodSchedule = new FoodSchedule();
     foodSchedule.Add("One insect for once a week.");
     WingSpan = wingSpan;
     Plumage  = plumage;
 }
예제 #5
0
    public static object ConvertToTypeSafeEnum(string typeName, string value)
    {
        switch (typeName)
        {
        case "BirdType":
            return(BirdType.Parse(value));

        //case "SomeOtherType": // other type safe enums
        //    return // some other type safe parse call
        default:
            return(null);
        }
    }
예제 #6
0
 public static bool TryParse(string value, out BirdType type)
 {
     try
     {
         type = Parse(value);
         return(true);
     }
     catch
     {
         type = null;
         return(false);
     }
 }
예제 #7
0
    public Milestone(int amount, string id = null, BirdType birdType = BirdType.Blue, List<Direction> directions = null)
    {
        Amount = amount;
        Id = id;
        
        Directions = directions;
        if (directions == null)
        {
            Directions = new List<Direction>();
        }

        BirdType = birdType;
    }
예제 #8
0
        /// <summary>
        /// Creates Bird
        /// </summary>
        /// <param name="bird">Species</param>
        /// <param name="id">ID</param>
        /// <param name="birdSpecific">Bird characteristics</param>
        /// <param name="speciesSpecific">Species characteristics</param>
        /// <returns>New Bird</returns>
        private static Animal CreateBird(BirdType bird, int id, string birdSpecific, string speciesSpecific)
        {
            switch (bird)
            {
            case BirdType.Dove:
                return(new Dove(id, birdSpecific, speciesSpecific));

            case BirdType.Eagle:
                return(new Eagle(id, birdSpecific, speciesSpecific));

            case BirdType.Pelican:
                return(new Pelican(id, birdSpecific, speciesSpecific));

            default:
                return(null);
            }
        }
        public IBird Get(string type)
        {
            BirdType bt = (BirdType)Enum.Parse(typeof(BirdType), type);
            IBird    bird;

            switch (bt)
            {
            case BirdType.Crow:
                bird     = new Bird("Black Crow", bt);
                bird.Fly = new SimpleFlyActivity();
                break;

            case BirdType.Duck:
                bird     = new Bird("White Pond Duck", bt);
                bird.Fly = new SmallFlyActivity();
                break;

            case BirdType.Eagle:
                bird     = new Bird("Grey Eagle", bt);
                bird.Fly = new JetFlyActivity();
                break;

            case BirdType.Owls:

                bird     = new Bird("Brown Owl", bt);
                bird.Fly = new SmallFlyActivity();
                break;

            case BirdType.Rubber:
                bird     = new Bird("Yellow Rubber Duck", bt);
                bird.Fly = new NoFlyActivity();
                break;

            case BirdType.Simple:
            default:
                bird     = new Bird("Simple White Bird", bt);
                bird.Fly = new SimpleFlyActivity();
                break;
            }
            Console.WriteLine("");
            Console.WriteLine("");
            Console.WriteLine("________________________");
            Console.WriteLine($"{bird.ToString()}");
            return(bird);
        }
예제 #10
0
        public IFly Fly(BirdType b)
        {
            IFly fly = null;

            switch (b)
            {
            case BirdType.Glede:
                fly = new GledeFly();
                break;

            case BirdType.Bird:
                fly = new BirdFly();
                break;

            default:
                throw new Exception("12323");
            }
            return(fly);
        }
예제 #11
0
 /// <summary>
 /// BullFinch constructor, passed to it is the property values
 /// This constructor calls the bird constructor (as a BullFinch is a bird)
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="age">Age</param>
 /// <param name="gender">Gender</param>
 /// <param name="typeOfBird">As bullfinch is a bird, type of bird needs to be passed</param>
 /// <param name="whatToSing">This is a property of bullfinch</param>
 public Bullfinch(string name, int age, Gender gender, BirdType typeOfBird, string whatToSing) : base(name, age, gender, typeOfBird)
 {
     foodSchedule = new FoodSchedule();
     foodSchedule.Add("One insect for three times a day.");
     WhatToSing = whatToSing;
 }
예제 #12
0
 /// <summary>
 /// Crow constructor, passed to it is the property values
 /// This constructor calls the bird constructor (as a Crow is a bird)
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="age">Age</param>
 /// <param name="gender">Gender</param>
 /// <param name="typeOfBird">As bullfinch is a bird, type of bird needs to be passed</param>
 /// <param name="whatSilverDoCrowLike">This is a crow property</param>
 public Crow(string name, int age, Gender gender, BirdType typeOfBird, string whatSilverDoCrowLike) : base(name, age, gender, typeOfBird)
 {
     foodSchedule = new FoodSchedule();
     foodSchedule.Add("Two insect for twice a day.");
     WhatSilverDoCrowLike = whatSilverDoCrowLike;
 }
예제 #13
0
 public void KillBird(BirdType birdType)
 {
     Birds [(int)birdType - 1].alive = false;
 }
예제 #14
0
 public Bird(BirdType birdType)
 {
     _birdtype = birdType;
 }
예제 #15
0
 public Bird(string name, BirdType type)
 {
     this.BirdName = name;
     this.BirdType = type;
 }
예제 #16
0
 public Bird(BirdType type)
 {
     _birdType      = type;
     _birdName      = type.ToString();
     birdSpritePath = CombinePath(defaultPath, _birdName);
 }
예제 #17
0
 public void SetBirdType(BirdType type)
 {
     _bird = new Bird(type);
     SetSprite(ActionType.Idle);
 }
예제 #18
0
 public AfricanBird(BirdType birdType) : base(birdType)
 {
 }
예제 #19
0
 /// <summary>
 /// Dog constructor, passed to it is the property values
 /// This constructor calls the Animal constructor (as a bird is an animal)
 /// </summary>
 /// <param name="name">Name of mammal</param>
 /// <param name="age">Age of mammal</param>
 /// <param name="gender">gender of mammal</param>
 /// <param name="typeOfBird">What type of bird this is</param>
 public Bird(string name, int age, Gender gender, BirdType typeOfBird) : base(name, age, gender)
 {
     TypeOfBird = typeOfBird;
 }
예제 #20
0
 public Bird(BirdType birdType)
 {
     this.BirdType = birdType;
 }
 public EuropeanBird(BirdType birdType) : base(birdType)
 {
 }
예제 #22
0
 public BirdMisc(GameObject go, BirdType birdType)
 {
     gameObject      = go;
     _spriteRenderer = go.GetComponent <SpriteRenderer>();
     _bird           = new Bird(birdType);
 }
예제 #23
0
 /// <summary>
 /// Constructs a new Flappy Bird.
 /// </summary>
 /// <param name="type">The Bird Type.</param>
 public FlappyBird(BirdType type) : base(EntityType.BIRD, START_LOCATION, new Rectangle((int)START_LOCATION.X, (int)START_LOCATION.Y, 24, 24))
 {
     this.type       = type;
     this.physics    = new BirdPhysics();
     this.flapChange = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 }
예제 #24
0
 public NorwegianBird(BirdType birdType) : base(birdType)
 {
 }