public void BurnManeuveringSet(ManeuveringAxisID axisID, float power) { if (m_ThrusterSystemSets.Count > m_CurrentThrusterSet) { ThrusterSystem currentThrusterSystem = null; int thrusterIndex = (int)axisID; currentThrusterSystem = m_ThrusterSystemSets[m_CurrentThrusterSet][(int)axisID]; if (null != currentThrusterSystem) { List <Thruster> thrusterList = null; if (power >= 0.0f) { thrusterList = currentThrusterSystem.GetYingThrusters(); } else { thrusterList = currentThrusterSystem.GetYangThrusters(); power = -power; } foreach (Thruster thruster in thrusterList) { thruster.Burn(power); } } } }
private bool RegisterThrusterSystemSet(List <Thruster> thrusters, string thrusterSetName, ThrusterSystemLoader.ManeuveringSystemRecord maneuveringSystemRecord) { List <ThrusterSystem> thrusterSystemList = new List <ThrusterSystem>(); for (int index = 0; index < maneuveringSystemRecord.Count; ++index) { ThrusterSystemLoader.ThrusterSystemRecord thrusterSystemRecord = maneuveringSystemRecord.GetThrusterSystem(index); if (null != thrusterSystemRecord) { ThrusterSystem thrusterSystem = null; if (RegisterThrusterSystem(thrusters, thrusterSystemRecord.Name, thrusterSystemRecord.Ying, thrusterSystemRecord.Yang, ref thrusterSystem)) { thrusterSystemList.Add(thrusterSystem); } } } if (thrusterSystemList.Count == maneuveringSystemRecord.Count) { m_ThrusterSystemSets.Add(thrusterSystemList); return(true); } else { return(false); } }
private bool RegisterThrusterSystem(List <Thruster> thrusters, string thrusterName, ReadOnlyCollection <string> yingNames, ReadOnlyCollection <string> yangNames, ref ThrusterSystem newThrusterSystem) { // We expect every thruster name found in the ying and yang collections to be the name of an actual thruster game object List <Thruster> yingThrusters = new List <Thruster>(); if (false == CollectThrusterObjects(thrusters, yingNames, yingThrusters)) { return(false); } List <Thruster> yangThrusters = new List <Thruster>(); if (false == CollectThrusterObjects(thrusters, yangNames, yangThrusters)) { return(false); } newThrusterSystem = new ThrusterSystem(yingThrusters, yangThrusters); //m_ThrusterSystems.Add( new ThrusterSystem( yingThrusters, yangThrusters ) ); //Debug.Log( "Registered thruster <" + thrusterName + "> at index " + (m_ThrusterSystems.Count - 1).ToString() ); return(true); }
void Start() { m_thruster = gameObject.transform.GetComponentInChildren <ThrusterSystem>(); }