示例#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 void UpdateAiming(float ticks)
        {
            // find rotation angle from us to target
            var targetDirection = CalcTargetDirection();

            // update our direction according to our rotation rate
            _rotationVel      = RotationRate * TargettingBase.ShortestRotationDirection(_currentDirection, targetDirection);
            _currentDirection = _currentDirection.Wrap(_rotationVel * ticks, 0.0f, Twopi);

            // see if we've arrived nearly enough, and snap
            if (Math.Abs(_currentDirection.Wrap(-targetDirection, 0.0f, Twopi)) <= RotationRate * ticks)
            {
                _currentDirection = targetDirection;
                _state            = TowerBehaviourState.Attacking;
            }

            _host.Rotation = _currentDirection;
        }