예제 #1
0
        public Dog(ILevelManager level, IUnit unit, DogType myType, bool loading)
            : base(level, unit)
        {
            this.myType         = myType;
            this.distCalc       = new DogDistCalc(this, 0.5f, 0.2f, 1);
            unit.AlwaysVertical = false;

            if (loading)
            {
                return;
            }

            animationController = CreateAnimationController(Unit);
            walker = WorldWalker.CreateNew(this, level);
            RegisterEvents(walker);
            MovingRangeTarget.CreateNew(this, level, targetOffset);
            healthBar    = new HealthBarControl(level, unit, 100, new Vector3(0, 1, 0), new Vector2(0.5f, 0.1f), true);
            currentState = new SearchingForTree((State)null, this);
        }
예제 #2
0
파일: Chicken.cs 프로젝트: MK4H/MHUrho
        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);
        }
예제 #3
0
        public static Wolf CreateNew(ILevelManager level, IUnit unit, WolfType myType)
        {
            Wolf wolf = new Wolf(level, unit, myType);

            wolf.animationController = CreateAnimationController(unit);
            wolf.walker   = WorldWalker.CreateNew(wolf, level);
            wolf.attacker = MovingMeeleAttacker.CreateNew(wolf,
                                                          level,
                                                          true,
                                                          new IntVector2(20, 20),
                                                          1,
                                                          5,
                                                          0.5f);
            wolf.healthBar = new HealthBarControl(level, unit, 100, new Vector3(0, 0.7f, 0), new Vector2(0.5f, 0.1f), true);
            UnitSelector.CreateNew(wolf, level);
            MovingRangeTarget.CreateNew(wolf, level, targetOffset);
            unit.AlwaysVertical = false;
            wolf.RegisterEvents();
            return(wolf);
        }