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); }
void Start() { if (!attatchedRB) { attatchedRB = GetComponent <Rigidbody>(); } //MovePoint = transform.position; tmpBSE = GetEngine(); SetTurnSpeed(); }
public void SetTurnSpeed() { if (!tmpBSE) { ShipTurnRate = 0.5f; tmpBSE = GetEngine(); } else { ShipTurnRate = tmpBSE.GetTurnRate(); } }
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(); }
/// <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(); } } }