Пример #1
0
 public void AddSpaceObject(SpaceObject spaceObject)
 {
     if (spaceObject.GetFaction() == "Player")
     {
         m_PlayerShips.Add(spaceObject);
         if (spaceObject.GetSize() == "Small")
         {
             m_PlayerSmallShips.Add(spaceObject);
             if (spaceObject.GetClass() == "Interceptor")
             {
                 m_PlayerInterceptors.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "HeavyAssault")
             {
                 m_PlayerHeavyAssault.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "Lancer")
             {
                 m_PlayerLancer.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "Support")
             {
                 m_PlayerSupport.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "Bomber")
             {
                 m_PlayerBomber.Add(spaceObject);
             }
             else
             {
                 Debug.LogError("invalid class : " + spaceObject.GetClass() + " for space object : " + spaceObject.gameObject.name);
             }
         }
         else if (spaceObject.GetSize() == "Large")
         {
             m_PlayerLargeShips.Add(spaceObject);
             if (spaceObject.GetClass() == "AssaultFregate")
             {
                 m_PlayerAssaultFregate.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "ArtilleryFregate")
             {
                 m_PlayerArtilleryFregate.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "SupportFregate")
             {
                 m_PlayerSupportFregate.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "AntiFighterFregate")
             {
                 m_PlayerAntiFighterFregate.Add(spaceObject);
             }
             else
             {
                 Debug.LogError("invalid class : " + spaceObject.GetClass() + " for space object : " + spaceObject.gameObject.name);
             }
         }
         else
         {
             Debug.LogError("invalid size : " + spaceObject.GetSize() + " for space object : " + spaceObject.gameObject.name);
         }
     }
     else if (spaceObject.GetFaction() == "Enemy")
     {
         m_EnemyShips.Add(spaceObject);
         if (spaceObject.GetSize() == "Small")
         {
             m_EnemySmallShips.Add(spaceObject);
             if (spaceObject.GetClass() == "Interceptor")
             {
                 m_EnemyInterceptors.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "HeavyAssault")
             {
                 m_EnemyHeavyAssault.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "Lancer")
             {
                 m_EnemyLancer.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "Support")
             {
                 m_EnemySupport.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "Bomber")
             {
                 m_EnemyBomber.Add(spaceObject);
             }
             else
             {
                 Debug.LogError("invalid class : " + spaceObject.GetClass() + " for space object : " + spaceObject.gameObject.name);
             }
         }
         else if (spaceObject.GetSize() == "Large")
         {
             m_EnemyLargeShips.Add(spaceObject);
             m_EnemyLargeShips.Add(spaceObject);
             if (spaceObject.GetClass() == "AssaultFregate")
             {
                 m_EnemyAssaultFregate.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "ArtilleryFregate")
             {
                 m_EnemyArtilleryFregate.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "SupportFregate")
             {
                 m_EnemySupportFregate.Add(spaceObject);
             }
             else if (spaceObject.GetClass() == "AntiFighterFregate")
             {
                 m_EnemyAntiFighterFregate.Add(spaceObject);
             }
             else
             {
                 Debug.LogError("invalid class : " + spaceObject.GetClass() + " for space object : " + spaceObject.gameObject.name);
             }
         }
         else
         {
             Debug.LogError("invalid size : " + spaceObject.GetSize() + " for space object : " + spaceObject.gameObject.name);
         }
     }
     else
     {
         Debug.LogError("invalid faction : " + spaceObject.GetFaction() + " for space object : " + spaceObject.gameObject.name);
     }
 }