Ejemplo n.º 1
0
 public void SetEnergy(float energyAmt)
 {
     energyBarSprite.sprite = this.barFrames[Mathf.Clamp(Mathf.RoundToInt(MathUtil.Map(energyAmt, 0, 100, 0, overloadFrame - 1)), 0, barFrames.Length - 1)];
     if (energyAmt == 199 && energyBoltSprite.GetCurrentAnimation() != energyBoltOverload)
     {
         energyBoltSprite.Play(energyBoltOverload);
     }
     if (energyAmt < 199 && gameObject.activeSelf)
     {
         energyBoltSprite.Play(energyBoltOff);
     }
 }
Ejemplo n.º 2
0
    public void KnockingUpdate()
    {
        if (slimeAtDoor.angry && animator.GetCurrentAnimation() != angryKnockAnim)
        {
            animator.Play(angryKnockAnim);
        }

        if (slimeAtDoor.leaving)
        {
            animator.Play(idleAnim);
            HideKnock();
            fsm.ChangeState(DoorState.Closed);
        }

        if (playerClose)
        {
            fsm.ChangeState(DoorState.Open);
        }
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        m_animController.SetWasPlayingClip(m_anim.GetCurrentAnimation());

        CalculateVelocity();
        HandleWallSliding();

        controller.Move(velocity * Time.deltaTime, directionalInput);

        //call here to make sure we're incorporating platform influence on player
        if (controller.collisions.above || controller.collisions.below)
        {
            if (controller.collisions.slidingDownMaxSlope)
            {
                velocity.y += controller.collisions.slopeNormal.y * -gravity * Time.deltaTime;
            }
            else
            {
                velocity.y = 0;
            }
        }
    }
Ejemplo n.º 4
0
 //Called at beginning of each PlayerController update to set the animation
 //that was just playing
 public void SetWasPlayingClip()
 {
     m_wasPlaying = m_anim.GetCurrentAnimation();
 }
Ejemplo n.º 5
0
 //Play an animation if it wasn't the animation playing before player input
 void PlayIfNotWasPlaying()
 {
     m_wasPlaying = m_anim.GetCurrentAnimation();
 }