예제 #1
0
 public static void ClearCapturableSkyrise(SkyriseSection sr)
 {
     if (capturableSkyrise == sr)
     {
         capturableSkyrise = null;
     }
 }
예제 #2
0
    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;
        }
    }
예제 #3
0
 void ReleaseSkyrise(SkyriseSection sr)
 {
     sr.transform.SetParent(null);
     sr.transform.localScale = new Vector3(1f, 1f, 1f);
     sr.Release();
     capturedSkyrise   = null;
     hasSkyriseSection = false;
 }
예제 #4
0
    //private static Block CapturableBlock;

    void Start()
    {
        SkyriseSection sr = GameObject.FindWithTag("Skyrise Section").GetComponent <SkyriseSection> ();

        sr.transform.position = skyriseStartPos;
        preloadingSkyrise     = sr;
        sr.Preload();
    }
예제 #5
0
 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);
     }
 }
예제 #6
0
 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();
     }
 }
예제 #7
0
    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);
    }
예제 #8
0
 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);
         }
     }
 }
예제 #9
0
 public static void SetCapturableSkyrise(SkyriseSection sr)
 {
     capturableSkyrise = sr;
 }