Example #1
0
    public void SpawnAtPosition(Vector3 pos, GameObject enemyPrefab)
    {
        GameObject zombieGo = Instantiate(enemyPrefab);

        zombieGo.transform.position = pos;

        AIZombie zombie = zombieGo.GetComponent <AIZombie>();

        zombie.target = target;

        enemies.Add(zombieGo);
    }
        public ZombieEntity(int row, Global.Creature zombieType)
        {
            Layer = 2;
            Tags.Add("Zombie");
            AI = new AIZombie(this);

            drawable = AddComponent(new CDrawable()) as CDrawable;
            moveable = AddComponent(new CMoveable()) as CMoveable;
            health   = AddComponent(new CHealth()) as CHealth;

            moveable.InitialSpeed = new Point(-20, 0);

            drawable.HitBox  = new Size(50, 94);
            drawable.Sprites = new List <string> {
                "zombie_1", "zombie_2", "zombie_3", "zombie_2"
            };
            drawable.Animated     = true;
            drawable.HitAnimation = true;
            switch (zombieType)
            {
            case (Global.Creature.ZombieCone):
                health.InitialHP   = 250;
                drawable.Accessory = "cone_1";
                break;

            case (Global.Creature.ZombieSot):
                health.InitialHP   = 500;
                drawable.Accessory = "sot_1";
                break;

            default:
                health.InitialHP = 150;
                break;
            }

            posX = Coord.GetXBordDroitEcran();
            posY = Coord.RowToY(row);
        }