コード例 #1
0
        private void UpdateInit(IUpdateEventArgs args)
        {
            _targetting         = new RadiusExitTargetting(args.Sim.Map, _host.Tile, 1, 1);
            _targetting.OwnTeam = _host.Stats.Team;

            _state = TowerBehaviourState.Searching;
        }
コード例 #2
0
        private float UpdateAdvancing(IUpdateEventArgs args)
        {
            // advance through tile
            _agent.TileProgress += _agent.Stats.MovementSpeed * args.Ticks;

            // advance to next tile, if necessary
            while (_agent.TileProgress > 1 && _pathIndex < (_mapPath.Count - 1))
            {
                // move to next tile
                _pathIndex          += 1;
                _agent.TileProgress -= 1.0f;
                args.Manager.Move(_agent, _mapPath[_pathIndex]);
            }

            // are we done?
            if (_pathIndex == (_mapPath.Count - 1) && _agent.TileProgress >= 0.5f)
            {
                _state = PathMobBehaviourStates.EndOfPath;
            }

            // calculate Position
            UpdatePosition();

            return(1.0f);
        }
コード例 #3
0
        private float UpdateInit(IUpdateEventArgs args)
        {
            // move into initial tile
            _pathIndex = 0;
            args.Manager.Move(_agent, _mapPath[_pathIndex]);
            _agent.TileProgress = 0.5f; // start in the center of our source tile

            _state = PathMobBehaviourStates.Advancing;

            return(1.0f);
        }
コード例 #4
0
        public float Update(IUpdateEventArgs args)
        {
            _elapsedTicks += args.Ticks;

            // reschedule if schedule not elapsed
            if (_elapsedTicks < _offsetTicks)
            {
                return(_offsetTicks - _elapsedTicks);
            }

            OnElapsed(args);
            return(0.0f);
        }
コード例 #5
0
        public float Update(IUpdateEventArgs args)
        {
            // Update according to the current state of the agent
            switch (_state)
            {
            case TowerBehaviourState.Init:
                UpdateInit(args);
                break;

            case TowerBehaviourState.Searching:
                UpdateSearching();
                break;

            case TowerBehaviourState.Aiming:
                UpdateAiming(args.Ticks);
                break;

            case TowerBehaviourState.Attacking:
                UpdateAttacking();
                break;

            case TowerBehaviourState.Removed:
                return(0.0f);

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Reschedule according to the (potentially updated) state of the agent
            switch (_state)
            {
            case TowerBehaviourState.Init:
                return(_ticksPerSecond / InitResolution);

            case TowerBehaviourState.Searching:
                return(_ticksPerSecond / SearchResolution);

            case TowerBehaviourState.Aiming:
                return(_ticksPerSecond / AimingResolution);

            case TowerBehaviourState.Attacking:
                return(_ticksPerSecond / AttackResolution);

            case TowerBehaviourState.Removed:
                return(0.0f);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #6
0
        public float Update(IUpdateEventArgs args)
        {
            switch (_state)
            {
            case PathMobBehaviourStates.Init:
                return(UpdateInit(args));

            case PathMobBehaviourStates.Advancing:
                return(UpdateAdvancing(args));

            case PathMobBehaviourStates.EndOfPath:
                return(UpdateEndOfPath(args));

            case PathMobBehaviourStates.Removed:
                // do nothing
                return(0.0f);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #7
0
ファイル: AgentBase.cs プロジェクト: kabourneeak/Catch
 public float Update(IUpdateEventArgs args)
 {
     return(BehaviourComponent.Update(args));
 }
コード例 #8
0
 protected abstract void OnElapsed(IUpdateEventArgs args);
コード例 #9
0
 public float Update(IUpdateEventArgs args)
 {
     // indicate that we do not require any further updates
     return(0.0f);
 }
コード例 #10
0
        protected override void OnElapsed(IUpdateEventArgs args)
        {
            var agent = args.Manager.CreateAgent(_agentName, _createArgs);

            args.Manager.Register(agent);
        }
コード例 #11
0
        public float Update(IUpdateEventArgs args)
        {
            OnElapsed(args);

            return(0.0f);
        }
コード例 #12
0
        private float UpdateEndOfPath(IUpdateEventArgs args)
        {
            args.Manager.Remove(this._agent);

            return(0.0f);
        }