Exemplo n.º 1
0
    public void CreatePoint()
    {
        if (LevelStateManager.canCreateTetherPoint())
        {
            //Debug.Log("Create tether point");
            //CreateTimeTetherIndicator(GameManager.GetPlayer().transform.position, LevelStateManager.curState + 1);
            LevelStateManager.createTetherPoint();

            GameManager.GetPlayerScript().setPlaceAnchorAnim();

            AudioLibrary.PlayTetherPlacementSound();
            // Timeline arrow
            SetArrowTarget(LevelStateManager.curState, false, true);

            if (LevelStateManager.curState < tetherUICreateParticles.Length && tetherUICreateParticles[LevelStateManager.curState] != null)
            {
                tetherUICreateParticles[LevelStateManager.curState].Play();
            }
        }
        else
        {
            if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.tetherError))
            {
                AudioLibrary.PlayTetherErrorSound();
            }
            Debug.Log("Can't create tether point right now");
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // TODO UpdateDashPanelActive() should probably be called when the dash ability is collected

        if (GameManager.dashIsCharged())
        {
            dashImg.color = Color.Lerp(dashImg.color, Color.white, colorLerpSpeed * Time.deltaTime);

            // Executes when the dash has finished charging
            if (!charged)
            {
                if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.dashRecharge))
                {
                    AudioLibrary.PlayDashRechargeSound();
                }
                charged = true;

                dashParticlesIn.Play();
            }
        }
        // If charging
        else
        {
            dashImg.color = Color.Lerp(dashImg.color, chargingSpriteColor, colorLerpSpeed * Time.deltaTime);

            // TODO set image fill
            float fillTarget = 1 - GameManager.dashChargePercNormalized();

            dashImg.fillAmount = Mathf.Lerp(dashImg.fillAmount, fillTarget, fillLerpSpeed * Time.deltaTime);
            //dashImg.fillAmount = 1 - GameManager.dashChargePercNormalized();
            charged = false;
        }

        /*
         * // Turn off dash image (make transparent) while dashing
         * if (GameManager.isPlayerDashing())
         * {
         *      dashImg.color = Color.Lerp(dashImg.color, Color.clear, 0.2f);
         * }
         * // If charged
         * else if (GameManager.dashIsCharged())
         * {
         *      dashImg.color = Color.Lerp(dashImg.color, Color.white, 0.2f);
         * }
         * // If charging
         * else
         * {
         *      dashImg.color = Color.Lerp(dashImg.color, chargingSpriteColor, 0.2f);
         *
         *      // TODO set image fill
         * }
         */
    }
Exemplo n.º 3
0
 public void PlayTetherMenuInSound()
 {
     Debug.Log("Play tether menu in sound");
     if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.tetherMenuOpen))
     {
         Debug.Log("Playing Open");
         AudioLibrary.PlayTetherMenuOpen();
     }
     if (GlobalAudio.ClipIsPlaying(AudioLibrary.inst.tetherMenuClose))
     {
         Debug.Log("Stopping Close");
         GlobalAudio.StopPlayingClip(AudioLibrary.inst.tetherMenuClose);
     }
 }
Exemplo n.º 4
0
    public override void perform(Controller c)
    {
        Player p = State.cast <Player> (c);

        Vector3 mousePos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));

        //bool inSBBounds = LevelStateManager.StasisBubbleAtPos (mousePos);

        // Use Stasis Placement ablility
        if (PlayerControlManager.GetKeyDown(ControlInput.FIRE_STASIS))
        {
            if (GameManager.inst.canUseStasis &&
                //!inSBBounds &&
                //!TetherManager.CursorIsOverATetherPoint () &&
                CursorManager.CursorInGameplayState())
            {
                p.setStasisShootAnim();
                c.getSelf().getAbility(0).use(c.getSelf(), mousePos);
            }

            if (!LevelStateManager.canAddStasisBubble() && !GlobalAudio.ClipIsPlaying(AudioLibrary.inst.stasisError))
            {
                AudioLibrary.PlayStasisErrorSound();
            }
        }

        // Use Dash ability
        if (PlayerControlManager.GetKeyDown(ControlInput.DASH))
        {
            if (GameManager.inst.canUseDash && CursorManager.CursorInGameplayState())
            {
                if (c.getSelf().getAbility(1).isReady())
                {
                    AudioLibrary.PlayDashForwardSound();
                }
                else
                {
                    if (!GlobalAudio.ClipIsPlaying(AudioLibrary.inst.dashError))
                    {
                        AudioLibrary.PlayDashErrorSound();
                    }
                }///
                c.getSelf().getAbility(1).use(c.getSelf(), p.getJumpTargetPos());
            }
        }

        p.move();
        p.findTarget();
    }