Inheritance: RTSEngine.Algorithms.ACBudgetedTask
Example #1
0
        private void AddTask(GameState s, RTSUnit unit)
        {
            // Init The Unit
            if (unit.CombatController != null)
            {
                unit.CombatController.Init(s, this, unit.Data.CombatControllerInitArgs);
            }
            if (unit.MovementController != null)
            {
                unit.MovementController.Init(s, this, unit.Data.MovementControllerInitArgs);
            }
            if (unit.AnimationController != null)
            {
                unit.AnimationController.Init(s, this, unit.Data.AnimationControllerInitArgs);
            }
            if (unit.ActionController != null)
            {
                unit.ActionController.Init(s, this, unit.Data.ActionControllerInitArgs);
            }

            var btu = new BTaskUnitDecision(s, unit);

            unit.OnDestruction += (o) => {
                tbEntityDecisions.RemoveTask(btu);
            };
            tbEntityDecisions.AddTask(btu);
        }
        private void AddTask(GameState s, RTSUnit unit)
        {
            // Init The Unit
            if(unit.CombatController != null) unit.CombatController.Init(s, this, unit.Data.CombatControllerInitArgs);
            if(unit.MovementController != null) unit.MovementController.Init(s, this, unit.Data.MovementControllerInitArgs);
            if(unit.AnimationController != null) unit.AnimationController.Init(s, this, unit.Data.AnimationControllerInitArgs);
            if(unit.ActionController != null) unit.ActionController.Init(s, this, unit.Data.ActionControllerInitArgs);

            var btu = new BTaskUnitDecision(s, unit);
            unit.OnDestruction += (o) => {
                tbEntityDecisions.RemoveTask(btu);
            };
            tbEntityDecisions.AddTask(btu);
        }