Esempio n. 1
0
    void Start()
    {
        rb2d           = GetComponent <Rigidbody2D> ();
        anim           = GetComponentInChildren <Animator> ();
        es             = GetComponent <EnemySide> ();
        canBeActivated = true;
        health         = 3;
        anim.SetBool("isLeft", true);
        renderer      = this.GetComponentInChildren <SpriteRenderer> ();
        originalColor = this.GetComponentInChildren <SpriteRenderer> ().color;
        for (int i = 0; i < this.gameObject.transform.GetChild(0).childCount; i++)
        {
            childList.Add(this.gameObject.transform.GetChild(0).GetChild(i).gameObject);
        }

        originalPosition = transform.position;
    }
Esempio n. 2
0
        public override void EnemyTurn()
        {
            Random   random = new Random();
            Creature vamp   = EnemySide[0].creature;

            if (vamp != null)
            {
                Ability chosenAbility = null;
                if (Rounds % 10 == 0)
                {
                    chosenAbility = vamp.Abilities[1];
                }
                else
                {
                    chosenAbility = vamp.Abilities[0];
                }

                int index = -1;

                Space[] side = new Space[3];
                if (chosenAbility.TargetType == "Hero")
                {
                    HeroSide.CopyTo(side, 0);
                }
                else if (chosenAbility.TargetType == "Enemy")
                {
                    EnemySide.CopyTo(side, 0);
                }
                while (index < 0)
                {
                    index = random.Next(side.Length);
                    {
                        if (side[index].creature != null)
                        {
                            if (side[index].creature.CurrHP > 0)
                            {
                                chosenAbility.setTargets(side, index);
                            }
                            else
                            {
                                index = -1;
                            }
                        }
                        else
                        {
                            index = -1;
                        }
                    }
                }

                int open = random.Next(3);
                if (open == 0)
                {
                    vamp.TopMod    = 1;
                    vamp.FrontMod  = 0;
                    vamp.BottomMod = 0;
                    Console.WriteLine("\nVampire Chicken pokes its head out of the top of the eggshell.");
                    Console.ReadLine();
                }
                else if (open == 1)
                {
                    vamp.TopMod    = 0;
                    vamp.FrontMod  = 1;
                    vamp.BottomMod = 0;
                    Console.WriteLine("\nVampire Chicken pokes its head out of a hole in the front of the shell.");
                    Console.ReadLine();
                }
                else if (open == 2)
                {
                    vamp.TopMod    = 0;
                    vamp.FrontMod  = 0;
                    vamp.BottomMod = 1;
                    Console.WriteLine("\nVampire Chicken hangs upside down like a bat. His head touches the floor.");
                    Console.ReadLine();
                }

                chosenAbility.execute(vamp);
                chosenAbility.Targets.Clear();
            }
        }