void InsertAnimation() { if (State == 1) { transform.localRotation = Quaternion.Slerp(RotA, RotB, Time / MaxTime); transform.localPosition = Vector3.Lerp(PosA, PosB, Time / MaxTime); Time += UnityEngine.Time.deltaTime; if (Time >= MaxTime) { State++; Time = 0; } } else if (State == 2) { transform.localPosition = Vector3.Lerp(PosB, PosC, Time / MaxTime); Time += UnityEngine.Time.deltaTime; if (Time >= MaxTime) { State++; Time = 0; } } else if (State == 3) { DX8.dx8 dx8 = GameObject.Find("DX8").GetComponent <DX8.dx8>(); dx8.SetEjectButton(true); dx8.UI_InsertFloppy(Path); State++; Direction = 0; } }
public void WarpFloppy(FloppySensor sensor) { Rigidbody rb = GetComponent <Rigidbody>(); HeldItem hd = GameObject.Find("Character").GetComponent <Character>().HeldItem; if (hd.Rb == rb) { hd.Deattach(); } Debug.Log("WarpFloppy.1 true"); rb.isKinematic = true; rb.detectCollisions = false; transform.SetParent(sensor.transform, true); transform.localPosition = new Vector3(0, 0, 0.25f); //Vector3.Lerp(PosB, PosC, Time / MaxTime); transform.localRotation = Quaternion.Euler(180, 0, -90); sensor.IsEmpty = false; sensor.Floppy = this; DX8.dx8 dx8 = GameObject.Find("DX8").GetComponent <DX8.dx8>(); dx8.SetEjectButton(true); }
public void EjectFloppy() { Time = 0.0f; MaxTime = 0.25f; State = 1; Direction = -1; PosA = transform.localPosition; PosB = new Vector3(0, 0, -1.5f); DX8.dx8 dx8 = GameObject.Find("DX8").GetComponent <DX8.dx8>(); dx8.SetEjectButton(false); }
public void WarpEjectFloppy() { DX8.dx8 dx8 = GameObject.Find("DX8").GetComponent <DX8.dx8>(); transform.localPosition = new Vector3(2.5f, 0, -1.5f); transform.parent = dx8.FloppyDiskStack; Rigidbody rb = GetComponent <Rigidbody>(); rb.isKinematic = false; rb.detectCollisions = true; dx8.FloppySensor.Floppy = null; dx8.FloppySensor.IsEmpty = true; dx8.FloppySensor.EjectCooldown = 1.25f; Debug.LogFormat("Warp Eject {0}", rb.isKinematic); }
void RemoveAnimation() { if (State == 1) { transform.localPosition = Vector3.Lerp(PosA, PosB, Time / MaxTime); Time += UnityEngine.Time.deltaTime; if (Time >= MaxTime) { DX8.dx8 dx8 = GameObject.Find("DX8").GetComponent <DX8.dx8>(); //dx8.FloppySensor.Ejecting = true; dx8.FloppySensor.EjectCooldown = MaxTime + 0.25f; dx8.UI_RemoveFloppy(); State++; Time = 0; } } else if (State == 2) { DX8.dx8 dx8 = GameObject.Find("DX8").GetComponent <DX8.dx8>(); transform.parent = dx8.FloppyDiskStack; Rigidbody rb = GetComponent <Rigidbody>(); rb.isKinematic = false; rb.detectCollisions = true; //rb.AddRelativeForce(new Vector3(0, 0, 2.0f)); dx8.FloppySensor.Floppy = null; dx8.FloppySensor.IsEmpty = true; //dx8.FloppySensor.EjectCooldown = 0.25f; Direction = 0; State++; } }