Ejemplo n.º 1
0
 public CLineOfSight(SPGame mGame, CBody mCBody, CShadower mCShadower)
 {
     _game = mGame;
     _cBody = mCBody;
     _cShadower = mCShadower;
     Targets = new HashSet<Tuple<Entity, SSVector2I>>();
 }
Ejemplo n.º 2
0
 public CControl(SPGame mGame, CStats mCStats, CBody mCBody, CMovement mCMovement, CRender mCRender)
 {
     _game = mGame;
     _cStats = mCStats;
     _cBody = mCBody;
     _cMovement = mCMovement;
     _cRender = mCRender;
 }
Ejemplo n.º 3
0
 public CRender(SPGame mGame, CBody mCBody, string mTextureName, string mTilesetName = null,
                string mLabelName = null, float mRotation = 0)
 {
     _game = mGame;
     _cBody = mCBody;
     _textureName = mTextureName;
     _tilesetName = mTilesetName;
     _labelName = mLabelName;
     _rotation = mRotation;
 }
Ejemplo n.º 4
0
        public CShadower(SPGame mGame, CBody mCBody, bool mIsDrawn, Color mColor, int mMultiplier = 35)
        {
            _game = mGame;
            _cBody = mCBody;
            _isDrawn = mIsDrawn;
            _color = mColor;
            _vertexArrays = new List<Vertex[]>();
            ShadowCaster = new ShadowCaster(_cBody.Position, mMultiplier);

            if (_isDrawn) _game.AddDrawAction(Draw, -10);
        }
Ejemplo n.º 5
0
        public CAI(SPGame mGame, CStats mCStats, CBody mCBody, CMovement mCMovement, CRender mCRender,
                   CLineOfSight mCLineOfSight)
        {
            _game = mGame;
            _cStats = mCStats;
            _cBody = mCBody;
            _cLineOfSight = mCLineOfSight;
            _cMovement = mCMovement;
            _cRender = mCRender;

            WaitAmplitude = _cStats.Speed.Total/5f + 50;
            WaitDelayMax = 450 - _cStats.Speed.Total/5 + _cStats.Endurance.Total*5f;
            BulletSpeedBase = 150 + _cStats.Agility.Total*8;
            BulletSpeedMax = 400 + _cStats.Agility.Total*10;
            BulletSpeedIncrease = 25 + _cStats.Agility.Total*3;
            WanderingDirectionDelayMax = 50 - _cStats.Speed.Total/8f;
            WanderingSpeed = _cStats.Speed.Total;
            ChaseSpeed = _cStats.Speed.Total/10f;
            ShootDelayMax = 40 - _cStats.Agility.Total/8f;

            _bulletSpeed = BulletSpeedBase;

            mCBody.OnCollision += (mCollisionInfo) =>
                                  {
                                      var entity = (Entity) mCollisionInfo.UserData;
                                      if (entity.HasTag(Tags.Wall))
                                      {
                                          if (_state == StateWandering && _turnAroundDelay <= 0)
                                          {
                                              _turnAroundDelay = TurnAroundDelayMax;
                                              _currentDirection += 90*Utils.Random.NextSign();
                                          }
                                      }

                                      if (entity.HasTag(Tags.BulletFriendly))
                                      {
                                          _state = StateWait;
                                          var vector = mCollisionInfo.Body.Position - mCollisionInfo.Body.Velocity*5;
                                          _currentDirection =
                                              Utils.Math.Angles.TowardsDegrees(new SSVector2F(_cBody.X, _cBody.Y),
                                                                               new SSVector2F(vector));
                                      }
                                  };
        }