public override void CollideFrom(GameEntity owner, Node collider) { base.CollideTo(owner, collider); Type type = owner.GetType(); if (type == typeof(EnemyTurtle)) { //collied enemy } }
public override void CollideTo(GameEntity owner, Node collider) { base.CollideTo(owner, collider); Type type = owner.GetType(); if (type == typeof(EnemyBase)) { // Logger.Debug("[PlayerBullet] Collied to Enemy"); Destroy(); } }
public override void CollideTo(GameEntity owner, Node collider) { base.CollideTo(owner, collider); Type type = owner.GetType(); if (type == typeof(EnemyTurtle)) { Logger.Debug("[PlayerBullet] Collied to Enemy"); CollisionDatas.RemoveAll( (x) => x.owner==this ); Velocity *= 0.3f; SetAnimation(BodySprite, "Explosion"); } }
public override void CollideFrom(GameEntity owner, Node collider) { base.CollideFrom(owner, collider); var enemyKiller = owner as EnemyKiller; if (enemyKiller!=null) { // Logger.Debug("[PlayerBullet] Collied from PlayerBullet"); CollisionDatas.RemoveAll( (x) => x.owner==this ); Velocity *= 0.0f; //spawn pieces { int nextKillerGen = enemyKiller.Generation + 1; int pieceCount = GlobalParams.EnemyPieceCount; for(int i=0; i<pieceCount; i++) { var pos = Position; var targetPos = pos + Game.Instance.Random.NextVector2( GlobalParams.EnemyPieceMoveLength ); var enemyPiece = new EnemyPiece( pos, targetPos, GlobalParams.EnemyPieceLifeTime ); enemyPiece.Generation = nextKillerGen; Game.Instance.AddQueue.Add(enemyPiece); } } //add score Game.Instance.ScoreManager.AddScore(2, enemyKiller.Generation); Game.Instance.EnemySpawner.EnemyDeadCountTotal ++ ; Game.Instance.RemoveQueue.Add(this); } }
public virtual void CollideTo(GameEntity owner, Node collider) { // Logger.Debug("CollideTo"); }
public void Add(CollisionEntityType type, GameEntity owner, Node collider, GetCenterDelegate center, GetRadiusDelegate radius) { CollisionEntry entry = new CollisionEntry() { type = type, owner = owner, collider = collider, center = center, radius = radius }; Add (entry); }