Inheritance: VeeEntity.Component
示例#1
0
 public CLineOfSight(SPGame mGame, CBody mCBody, CShadower mCShadower)
 {
     _game = mGame;
     _cBody = mCBody;
     _cShadower = mCShadower;
     Targets = new HashSet<Tuple<Entity, SSVector2I>>();
 }
示例#2
0
 public CControl(SPGame mGame, CStats mCStats, CBody mCBody, CMovement mCMovement, CRender mCRender)
 {
     _game = mGame;
     _cStats = mCStats;
     _cBody = mCBody;
     _cMovement = mCMovement;
     _cRender = mCRender;
 }
示例#3
0
        public CChild(Entity mParent, CBody mCBody)
        {
            _parent     = mParent;
            _cBody      = mCBody;
            _parentBody = _parent.GetComponentUnSafe <CBody>();

            _parent.OnDestroy += () => Entity.Destroy();
        }
示例#4
0
 public CControl(SPGame mGame, CStats mCStats, CBody mCBody, CMovement mCMovement, CRender mCRender)
 {
     _game      = mGame;
     _cStats    = mCStats;
     _cBody     = mCBody;
     _cMovement = mCMovement;
     _cRender   = mCRender;
 }
示例#5
0
        public CChild(Entity mParent, CBody mCBody)
        {
            _parent = mParent;
            _cBody = mCBody;
            _parentBody = _parent.GetComponentUnSafe<CBody>();

            _parent.OnDestroy += () => Entity.Destroy();
        }
示例#6
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;
 }
示例#7
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;
 }
示例#8
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);
        }
示例#9
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);
            }
        }
示例#10
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));
                }
            };
        }
示例#11
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));
                                      }
                                  };
        }
示例#12
0
 private CAI AI(CStats mCStats, CBody mCBody, CMovement mCMovement, CRender mCRender, CLineOfSight mCLineOfSight)
 {
     return new CAI(_game, mCStats, mCBody, mCMovement, mCRender, mCLineOfSight);
 }
示例#13
0
 public CMovement(CBody mCBody)
 {
     _cBody = mCBody;
 }
示例#14
0
 private CChild Child(Entity mParent, CBody mCBody)
 {
     return new CChild(mParent, mCBody);
 }
示例#15
0
 private CControl Control(CBody mCBody, CStats mCStats, CMovement mCMovement, CRender mCRender)
 {
     return new CControl(_game, mCStats, mCBody, mCMovement, mCRender);
 }
示例#16
0
 public CMovement(CBody mCBody)
 {
     _cBody = mCBody;
 }
示例#17
0
 private CMovement Movement(CBody mCBody)
 {
     return new CMovement(mCBody);
 }
示例#18
0
 private CRender Render(CBody mCBody, string mTextureName, string mTilesetName = null, string mLabelName = null,
                        float mRotation = 0)
 {
     return new CRender(_game, mCBody, mTextureName, mTilesetName, mLabelName, mRotation);
 }