示例#1
0
文件: Ship.cs 项目: jwmcglynn/TeamQ
 //Tells if this is allied to s
 public bool IsAllied(TakesDamage s)
 {
     if (this == s)
     {
         return true; //I like myself
     }
     else if (this == Environment.sputnik.controlled) //Im sputnik
     {
         return s.IsFriendly(); //Sputnik only likes his friendly buddies
     }
     else if (s is Ship) //Im a ship, and I better have the AI controlling me and my target is a ship
     {
         if (((Ship)s).ai.IsDisabled())
         {
             return false;  //No mercy for the weak
         }
         else if (!(ai is AIController))
             return false;  //This case is strange, I'm actually not sure when this happens, but I don't like it
         else if (ai.IsAlliedWithPlayer()) //Means Im allied with player
         {
             return s.IsFriendly();
         }
         else if (((AIController)ai).target == s) //You are my target
         {
             if (((Ship)s).sputnikDetached) //We forgive you if sputnik did bad things to you
                 return ((Ship)s).timeSinceDetached >= 3.0f;
             else
                 return false;  //Otherwise we don't like you
         }
         else
             return true;  //You aren't my target, you are okay
     }
     else if (s is Boss)  //Im a ship and my target is a boss
     {
         return !IsFriendly(); //Only friendly people hate boss
     }
     else
     {
         return false;  //If its not a ship or a boss, we don't like it
     }
 }