コード例 #1
0
    private BaseShipEngine GetEngine()
    {
        Modules mods = transform.root.GetComponent <Modules>();

        if (mods)
        {
            GameObject engineGO = mods.GetEngine();
            if (engineGO)
            {
                BaseShipEngine engine = engineGO.GetComponentInChildren <BaseShipEngine>();
                if (engine)
                {
                    return(engine);
                }
                else
                {
                    //Debug.Log("Missing engine on " + name);
                }
            }
            else
            {
                Debug.Log("Missing engine from mods on " + gameObject.name);
            }
        }
        else
        {
            Debug.Log("Missing mods in movement on " + gameObject.name);
        }
        return(null);
    }
コード例 #2
0
 void Start()
 {
     if (!attatchedRB)
     {
         attatchedRB = GetComponent <Rigidbody>();
     }
     //MovePoint = transform.position;
     tmpBSE = GetEngine();
     SetTurnSpeed();
 }
コード例 #3
0
 public void SetTurnSpeed()
 {
     if (!tmpBSE)
     {
         ShipTurnRate = 0.5f;
         tmpBSE       = GetEngine();
     }
     else
     {
         ShipTurnRate = tmpBSE.GetTurnRate();
     }
 }
コード例 #4
0
 void Start()
 {
     mods     = transform.root.GetComponent <Modules>();
     spawnPos = transform.position;
     engineGO = mods.GetEngine();
     if (engineGO)
     {
         equipedEngine = engineGO.GetComponentInChildren <BaseShipEngine>();
         if (equipedEngine)
         {
             cruiseSpeed = equipedEngine.GetCrusingSpeed();
             boostSpeed  = equipedEngine.GetBoostSpeed();
             turnRate    = equipedEngine.GetTurnRate();
         }
     }
     equpiedWeapons = mods.GetWeapons();
 }
コード例 #5
0
 /// <summary>
 /// Increase ship speed depending on the engine equiped
 /// </summary>
 private void BoostShip(bool argBool)
 {
     if (!tmpBSE)
     {
         //Debug.Log("Engine not found");
         speed  = 1;
         tmpBSE = GetEngine();
     }
     else
     {
         if (Input.GetButton(BoostAxis))
         {
             speed = tmpBSE.GetBoostSpeed();
         }
         else
         {
             speed = tmpBSE.GetCrusingSpeed();
         }
     }
 }