示例#1
0
        void Update()
        {
            if (TheGame.Get().IsPaused())
            {
                return;
            }

            //Anims
            animator.SetBool("Jumping", character.IsJumping());
            animator.SetBool("InAir", !character.IsGrounded());
            animator.SetBool("Crouching", character.IsCrouching());
            animator.SetFloat("Speed", character.GetMove().magnitude);
            animator.SetBool("Climb", character.IsClimbing());
            if (character_item != null)
            {
                animator.SetBool("Hold", character_item.GetHeldItem() != null);
            }

            //Hit flashing
            render.color = new Color(render.color.r, render.color.g, render.color.b, 1f);
            if (flash_fx_timer > 0f)
            {
                flash_fx_timer -= Time.deltaTime;
                float alpha = Mathf.Abs(Mathf.Sin(flash_fx_timer * Mathf.PI * 4f));
                render.color = new Color(render.color.r, render.color.g, render.color.b, alpha);
            }
        }
 void Update()
 {
     //Anims
     animator.SetBool("Jumping", character.IsJumping());
     animator.SetBool("InAir", !character.IsGrounded());
     animator.SetBool("Crouching", character.IsCrouching());
     animator.SetFloat("Speed", character.GetMove().magnitude);
     if (character_item != null)
     {
         animator.SetBool("Hold", character_item.GetHeldItem() != null);
     }
 }
示例#3
0
        public bool CanTake(GameObject taker)
        {
            CharacterHoldItem player       = taker.GetComponent <CharacterHoldItem>();
            CarryItem         current_item = player.GetHeldItem();

            if (current_item != null && item_type == current_item.item_type)
            {
                return(false);
            }

            if (take_timer >= -0.01f)
            {
                //Avoid taking back an item you just threw
                return(!throwing || last_bearer != taker);
            }

            return(false);
        }