Exemple #1
0
    void FixedUpdate()
    {
        if (initialization)
        {
            if (!UIPowerBar.IsVisible())
            {
                HidePowerBar();
            }
            HideKey();
            initialization = false;
        }

        if (Player.HasOrbem())
        {
            if (Player.CanSwitchWorld() && orbState.Equals(OrbState.NOTACTIVABLE))
            {
                orbState = OrbState.ACTIVABLE;
                UIPowerBar.EnablePowerBar();
            }
            else if (!Player.CanSwitchWorld() && orbState.Equals(OrbState.ACTIVABLE))
            {
                orbState = OrbState.NOTACTIVABLE;
                UIPowerBar.DisablePowerBar();
            }
        }
    }
    public static void HideMiniMap()
    {
        instance.mask.transform.localScale = new Vector3(70f, 0f, 70f);
        instance.gameObject.SetActive(false);

        UIPowerBar.RemoveListener();
        UIPowerBar.StartRegen();
    }
Exemple #3
0
 protected override void Activate()
 {
     if (CanSwitchWorld() && Player.CanSwitchWorld() && !UIPowerBar.IsEmpty())
     {
         Switch();
         GameManager.SwitchWorld();
         animator.SetTrigger("zoomIn");
     }
 }
    public static void DisplayMiniMap()
    {
        instance.mask.transform.localScale = new Vector3(160f, 0f, 90f);
        instance.gameObject.SetActive(true);

        // the minimap consume power, start depleting the power bar
        UIPowerBar.SetListener(new PowerBarListenerForMiniMap());
        UIPowerBar.StartDecrease(1f);
    }
Exemple #5
0
    // Update is called once per frame
    void LateUpdate()
    {
        if (!isPaused && Player.HasOrbem())
        {
            if (Player.CanSwitchWorld() && UIPowerBar.IsEmpty() && !WorldManager.IsWorldFuture() && MaskController.CanBeOpenedOrClosed())
            {
                StartCoroutine(TeleportToFuture());
            }


            if (Input.GetButtonDown("Open/Close Gate") && CanSwitchWorld())
            {
                SwitchWorld();
            }

            if (WorldManager.IsWorldFuture() && Input.GetButtonDown("MiniMap") && !UIPowerBar.IsEmpty())
            {
                MiniMapController.SwitchMiniMapState();
            }

            if (Input.GetKeyDown("v"))
            {
                Debug.Log("Start decrease");
                UIPowerBar.StartDecrease(2f);
            }

            if (Input.GetKeyDown("b"))
            {
                Debug.Log("Start regen");
                UIPowerBar.StartRegen();
            }
        }


        if (Input.GetButtonDown("Pause"))
        {
            if (isPaused)
            {
                Resume();
                UIManager.HidePauseMenu();
            }
            else
            {
                Pause();
                UIManager.DisplayPauseMenu();
            }
        }

        // delay next update by 1 frame to prevent from "jumping" with a controller
        if (isPaused && pauseExited)
        {
            isPaused    = false;
            pauseExited = false;
        }
    }
Exemple #6
0
 public void OnPowerBarEmpty()
 {
     if (Player.CanSwitchWorld())
     {
         GameManager.SwitchWorld();
     }
     else
     {
         UIPowerBar.BlockRegen();
     }
 }
Exemple #7
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;

            orbActivable.enabled    = true;
            orbNonActivable.enabled = false;
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemple #8
0
    public void TeleportToPresent()
    {
        MiniMapController.HideMiniMap();
        Player.SwitchWorld();

        // UI
        UIPowerBar.SetListener(new PowerBarListenerForSwitch());
        UIPowerBar.StartDecrease(2f);

        // start opening the gate asynchronously
        Debug.Log("OpenGate Async");
        instance.StartCoroutine(MaskController.instance.OpenGateAsync());

        // display the second camera
        WorldManager.SwitchWorld();

        Player.instance.wallHit = false;
    }
Exemple #9
0
    public IEnumerator TeleportToFuture()
    {
        Player.SwitchWorld();

        //change the transparence of the ghost
        GhostPlayer.SetVisible();

        // close the gate
        yield return(MaskController.instance.CloseGateAsync());

        // go back to transparent
        GhostPlayer.SetTranparent();

        // hide the second camera
        WorldManager.SwitchWorld();

        // UI
        UIPowerBar.RemoveListener();
        UIPowerBar.StartRegen();

        Player.instance.wallHit = false;
    }
Exemple #10
0
 public static void HidePowerBar()
 {
     UIPowerBar.Hide();
     UICollectable.ChangeYPosition(-40f);
 }
Exemple #11
0
 public static void ShowPowerBar()
 {
     UIPowerBar.Show();
     UICollectable.ChangeYPosition(-130f);
 }
Exemple #12
0
 public bool CanSwitchWorld()
 {
     return(Player.CanSwitchWorld() && !UIPowerBar.IsEmpty() && MaskController.CanBeOpenedOrClosed());
 }