//public Animator doorAnimator; //public float doorPosition; void Awake() { aircraft = GetComponent <AIAircraftSpawn>(); pilot = GetComponent <AIPilot>(); rb = GetComponent <Rigidbody>(); //doorAnimator = GetComponentInChildren<Animator>(); gearAnimator = GetComponentInChildren <GearAnimator>(); tailHook = GetComponentInChildren <Tailhook>(); catHook = GetComponentInChildren <CatapultHook>(); refuelPort = GetComponentInChildren <RefuelPort>(); wingRotator = pilot.wingRotator; kPlane = GetComponent <KinematicPlane>(); fuelTank = GetComponent <FuelTank>(); waypoint = new Waypoint(); GameObject waypointObject = new GameObject(); waypointObject.AddComponent <FloatingOriginTransform>(); waypoint.SetTransform(waypointObject.transform); tilter = GetComponent <TiltController>(); normalSpeed = pilot.navSpeed; health = GetComponent <Health>(); health.OnDeath.AddListener(OnDeath); }
public void OnSceneGUI() { Handles.color = Color.green; Tailhook instance = target as Tailhook; Vector3 position = instance.transform.position; Vector3 previousPosition = Vector3.zero; for (int i = 0; i < _pathSegements.arraySize; i++) { SerializedProperty vectorProperty = _pathSegements.GetArrayElementAtIndex(i); Vector3 localPosition = vectorProperty.vector3Value; Vector3 worldPosition = localPosition + position; EditorGUI.BeginChangeCheck(); { worldPosition = Handles.PositionHandle(worldPosition, Quaternion.identity); } if (EditorGUI.EndChangeCheck()) { localPosition = worldPosition - position; vectorProperty.vector3Value = localPosition; } int controlID = GUIUtility.GetControlID(FocusType.Passive); Handles.SphereHandleCap(controlID, worldPosition, Quaternion.identity, 1f, Event.current.type); previousPosition = localPosition; } serializedObject.ApplyModifiedProperties(); Handles.color = Color.white; }
public static string GetHook(GameObject vehicle) { try { Tailhook hook = vehicle.GetComponentInChildren <Tailhook>(); //Nullable boolean allows it to get "stalling" if it doesn't exist? and sets it as false? I think. Boolean?deployed = Traverse.Create(hook).Field("deployed").GetValue() as Boolean?; return(deployed.ToString()); } catch (Exception ex) { support.WriteErrorLog("unable to get stall status: " + ex.ToString()); return("False"); } }
private void Awake() { actor = gameObject.GetComponent <Actor>(); lastFiringMessage = new Message_WeaponFiring(-1, false, false, networkUID); // lastStoppedFiringMessage = new Message_WeaponStoppedFiring(networkUID); lastCountermeasureMessage = new Message_FireCountermeasure(true, true, networkUID); lastDeathMessage = new Message_Death(networkUID, false); wheelsController = GetComponent <WheelsController>(); aeroController = GetComponent <AeroController>(); isPlayer = actor.isPlayer; sequenceNumber = 0; lastMessage = new Message_PlaneUpdate(false, 0, 0, 0, 0, 0, 0, false, false, false, networkUID, sequenceNumber); engine = gameObject.GetComponentInChildren <ModuleEngine>(); if (engine == null) { Debug.Log("engine was null on vehicle " + gameObject.name); } weaponManager = GetComponent <WeaponManager>(); if (weaponManager == null) { Debug.LogError("Weapon Manager was null on vehicle " + gameObject.name); } else { traverse = Traverse.Create(weaponManager); Networker.WeaponSet += WeaponSet; //weaponManager.OnWeaponEquipped += Rearm; //weaponManager.OnWeaponUnequippedHPIdx +=Rearm; //detect player rearm PlayerVehicleSetup pv = gameObject.GetComponent <PlayerVehicleSetup>(); if (pv != null) { pv.OnEndRearming.AddListener(Rearm); } if (actor.isPlayer && weaponManager.GetIWBForEquip(3) != null) { iwb = weaponManager.GetIWBForEquip(3); } } cmManager = GetComponentInChildren <CountermeasureManager>(); if (cmManager == null) { Debug.LogError("CountermeasureManager was null on vehicle " + gameObject.name); } else { cmManager.OnFiredCM += FireCountermeasure; } fuelTank = GetComponent <FuelTank>(); if (fuelTank == null) { Debug.LogError("FuelTank was null on vehicle " + gameObject.name); } Debug.Log("Done Plane Sender"); tailhook = GetComponentInChildren <Tailhook>(); launchBar = GetComponentInChildren <CatapultHook>(); refuelPort = GetComponentInChildren <RefuelPort>(); }