Esempio n. 1
0
        public static Chicken CreateNew(ILevelManager level, IUnit unit, ChickenType type)
        {
            Chicken newChicken = new Chicken(level, unit, type);

            newChicken.animationController = unit.CreateComponent <AnimationController>();
            newChicken.Walker  = WorldWalker.CreateNew(newChicken, level);
            newChicken.Shooter = Shooter.CreateNew(newChicken, level, type.ProjectileType, new Vector3(0, 0.7f, -0.7f), 20);
            newChicken.Shooter.SearchForTarget   = true;
            newChicken.Shooter.TargetSearchDelay = 2;
            newChicken.healthBar = new HealthBarControl(level, unit, 100, new Vector3(0, 15, 0), new Vector2(0.5f, 0.1f), true);

            var selector = UnitSelector.CreateNew(newChicken, level);

            MovingRangeTarget.CreateNew(newChicken, level, new Vector3(0, 0.5f, 0));

            newChicken.RegisterEvents(newChicken.Walker, newChicken.Shooter, selector);

            return(newChicken);
        }