示例#1
0
 void UpdatePlayerCollision(Player p, Enemy e)
 {
     if (IsPlayerColliding(p, e))
     {
         e.SetEnemyVelocity(-1f * e.GetEnemyVelocity());
     }
 }
示例#2
0
 void UpdateEnemyCollision(Enemy e1, Enemy e2)
 {
     if (IsEnemysColliding(e1, e2))
     {
         Vector2 temp = e1.GetEnemyVelocity();
         e1.SetEnemyVelocity(e2.GetEnemyVelocity());
         e2.SetEnemyVelocity(temp);
     }
 }
示例#3
0
 private bool IsPlayerColliding(Player p, Enemy e)
 {
     if (p.GetPlayerPosition() == e.GetEnemyPosition()) return true;
     else return false;
 } 
示例#4
0
 private bool IsEnemysColliding(Enemy e1, Enemy e2)
 {
     if (e1.GetEnemyPosition() == e2.GetEnemyPosition()) return true;
     else return false;
 }