public static void ClearCapturableSkyrise(SkyriseSection sr) { if (capturableSkyrise == sr) { capturableSkyrise = null; } }
void Update() { clampState = redClamp.clampState; switch (clampState) { case (int)ClampStates.OPEN: if (hasSkyriseSection) { ReleaseSkyrise(capturedSkyrise); } break; case (int)ClampStates.CLOSED: if (hasSkyriseSection) { } else { SkyriseSection sr = FieldElementManager.GetCapturableSkyrise(); if (sr != null) { CaptureSkyrise(sr); } } break; } }
void ReleaseSkyrise(SkyriseSection sr) { sr.transform.SetParent(null); sr.transform.localScale = new Vector3(1f, 1f, 1f); sr.Release(); capturedSkyrise = null; hasSkyriseSection = false; }
//private static Block CapturableBlock; void Start() { SkyriseSection sr = GameObject.FindWithTag("Skyrise Section").GetComponent <SkyriseSection> (); sr.transform.position = skyriseStartPos; preloadingSkyrise = sr; sr.Preload(); }
void OnTriggerExit(Collider other) { Debug.Log("Trigger Exited"); //if a skyrise exits our trigger, it is no longer capturable if (other.gameObject.tag == "Skyrise Section") { SkyriseSection sr = other.gameObject.GetComponent <SkyriseSection>(); sr.isCapturable = false; FieldElementManager.ClearCapturableSkyrise(sr); } }
void Update() { if (preloadingSkyrise.isInPlay) { preloadingSkyrise = Instantiate( preloadingSkyrise, skyriseStartPos, Quaternion.Euler(0.2f, 0f, 0.2f)) as SkyriseSection; preloadingSkyrise.transform.localScale = new Vector3(1f, 1f, 1f); preloadingSkyrise.Preload(); } }
void CaptureSkyrise(SkyriseSection sr) { sr.Capture(); capturedSkyrise = sr; hasSkyriseSection = true; instantTransform = new CopyTransform(transform); skyriseOffset = new CopyTransform( sr.transform.position - instantTransform.position, instantTransform.rotation); sr.transform.SetParent(transform); }
void OnTriggerEnter(Collider other) { Debug.Log("Trigger Entered"); //if a skyrise enters our trigger, it is capturable if (clampState == (int)ClampStates.OPEN) { Debug.Log("Clamp is open"); if (other.gameObject.tag == "Skyrise Section") { SkyriseSection sr = other.gameObject.GetComponent <SkyriseSection>(); sr.isCapturable = true; FieldElementManager.SetCapturableSkyrise(sr); } } }
public static void SetCapturableSkyrise(SkyriseSection sr) { capturableSkyrise = sr; }