private void Awake() { if (floatingmesh == null) { floatingmesh = GetComponentInParent <FloatingMesh>(); } if (rigidbody == null) { rigidbody = GetComponentInParent <Rigidbody>(); } }
public void ObjectEnter(GameObject groundObject) { if (!groundObjects.Contains(groundObject)) { removedObjects.Remove(groundObject); groundObjects.Add(groundObject); groundRigids.Add(groundObject.GetComponentInParent <Rigidbody>()); FloatingMesh componentInParent = groundObject.GetComponentInParent <FloatingMesh>(); if (componentInParent != null && !shipStartPositions.ContainsKey(componentInParent)) { shipStartPositions[componentInParent] = groundObject.transform.position; } GroundVehicle componentInParent2 = groundObject.GetComponentInParent <GroundVehicle>(); if (componentInParent2 != null && !vehicleStartPositions.ContainsKey(componentInParent2)) { vehicleStartPositions[componentInParent2] = groundObject.transform.position; } } }