Exemple #1
0
 public override void OnCollision(CGameObject pObj)
 {
     if (pObj.ObjType == EGameObjectType.GotAsteroid)
     {
         _pObjMan.AddObject(new CExplo(_pObjMan, _pEngineCore, _stPos, _fSize));
         _pObjMan.RemoveObject(this);
     }
 }
Exemple #2
0
        // collision with shot is fatal
        public override void OnCollision(CGameObject pObj)
        {
            if (pObj.ObjType != EGameObjectType.GotShot && pObj.ObjType != EGameObjectType.GotPlayer) return;
            // spawn little children asteroids
            if (_fSize > 25f)
            {
                uint count = (uint)(2 + Rand.Next(3));
                for (int i = 0; i < count; i++)
                {
                    _pObjMan.AddObject(new CAsteroid(_pObjMan, _pEngineCore,
                        new TPoint2(_stPos.x - _fSize / 4f + Rand.Next((int)(_fSize / 2f)),
                            _stPos.y - _fSize / 4f + Rand.Next((int)(_fSize / 2f))), _fSize * 0.5f));
                }
            }

            _pObjMan.AddObject(new CExplo(_pObjMan, _pEngineCore, _stPos, _fSize));
            _pObjMan.AddObject(new CScorePopup(_pObjMan, _pEngineCore, _stPos, _fSize, (uint)(_fSize * 5)));
            _pObjMan.RemoveObject(pObj);
            _pObjMan.RemoveObject(this);
        }
Exemple #3
0
        // collision with shot is fatal
        public override void OnCollision(CGameObject pObj)
        {
            if (pObj.ObjType != EGameObjectType.GotShot && pObj.ObjType != EGameObjectType.GotPlayer)
            {
                return;
            }
            // spawn little children asteroids
            if (_fSize > 25f)
            {
                uint count = (uint)(2 + Rand.Next(3));
                for (int i = 0; i < count; i++)
                {
                    _pObjMan.AddObject(new CAsteroid(_pObjMan, _pEngineCore,
                                                     new TPoint2(_stPos.x - _fSize / 4f + Rand.Next((int)(_fSize / 2f)),
                                                                 _stPos.y - _fSize / 4f + Rand.Next((int)(_fSize / 2f))), _fSize * 0.5f));
                }
            }

            _pObjMan.AddObject(new CExplo(_pObjMan, _pEngineCore, _stPos, _fSize));
            _pObjMan.AddObject(new CScorePopup(_pObjMan, _pEngineCore, _stPos, _fSize, (uint)(_fSize * 5)));
            _pObjMan.RemoveObject(pObj);
            _pObjMan.RemoveObject(this);
        }
Exemple #4
0
 public void RemoveObject(CGameObject pObj)
 {
     _clRemovePendingList.Add(pObj);
 }
Exemple #5
0
 public void AddObject(CGameObject pObj)
 {
     _clObjects.Add(pObj);
 }
Exemple #6
0
 public void RemoveObject(CGameObject pObj)
 {
     _clRemovePendingList.Add(pObj);
 }
Exemple #7
0
 public void AddObject(CGameObject pObj)
 {
     _clObjects.Add(pObj);
 }
Exemple #8
0
 public virtual void OnCollision(CGameObject pObj)
 {
 }
Exemple #9
0
 public virtual bool CollisionCheck(CGameObject pObjWith)
 {
     return(_stPos.DistTo(pObjWith._stPos) < _fSize / 2f * _fColScale + pObjWith._fSize / 2f * pObjWith._fColScale);
 }
Exemple #10
0
 public override void OnCollision(CGameObject pObj)
 {
     if (pObj.ObjType == EGameObjectType.GotAsteroid)
     {
         _pObjMan.AddObject(new CExplo(_pObjMan, _pEngineCore, _stPos, _fSize));
         _pObjMan.RemoveObject(this);
     }
 }
Exemple #11
0
 public virtual void OnCollision(CGameObject pObj)
 {
 }
Exemple #12
0
 public virtual bool CollisionCheck(CGameObject pObjWith)
 {
     return _stPos.DistTo(pObjWith._stPos) < _fSize / 2f * _fColScale + pObjWith._fSize / 2f * pObjWith._fColScale;
 }