第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

在 Unity 中重生后停止死亡動(dòng)畫

在 Unity 中重生后停止死亡動(dòng)畫

C#
森林海 2021-05-19 21:22:21
因此,我有一個(gè)玩家與敵人碰撞時(shí)將開始“傷害”動(dòng)畫的玩家。2秒后,他將重新生成自己的起始位置,但“傷害”動(dòng)畫不會(huì)停止。即使玩家在四處移動(dòng),它也可以繼續(xù)播放。這是我的整個(gè)播放器腳本:using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class Player : MonoBehaviour{    public float speed = 3.0f;    public Vector2 jumpHeight;    [HideInInspector] public bool facingRight = true;    private float minX = -10.5f;    private float maxX = 10.5f;    public int count;    public Text countText;    private Animator anim;    public GameObject NECText;    public GameObject WinText;    public GameObject player;    void Start()    {        anim = GetComponent<Animator>();        transform.position = new Vector3(-10.0f, -2.32f, 0);        count = 0;        countText.text = "Coins: " + count.ToString();        NECText.gameObject.SetActive(false);        WinText.gameObject.SetActive(false);    }    void Update()    {        Movement();        Death();        float horizontalInput = Input.GetAxis("Horizontal");        if(horizontalInput > 0 && !facingRight)        {            Flip();        }        else if(horizontalInput < 0 && facingRight)        {            Flip();        }    }    void Movement()    {        float horizontalInput = Input.GetAxis("Horizontal");        transform.Translate(Vector3.right * horizontalInput * speed * Time.deltaTime);        if(Input.GetKeyDown(KeyCode.Space)) //fix unlimited jump        {            GetComponent<Rigidbody2D>().AddForce(jumpHeight, ForceMode2D.Impulse);        }        if(transform.position.x < minX)        {            transform.position = new Vector3 (minX, transform.position.y, 0);        }        else if(transform.position.x > maxX)        {            transform.position = new Vector3(maxX, transform.position.y, 0);        }    }    void Death()    {        if (transform.position.y <= -4.25f)        {            anim.SetBool("isHurt", true);            Invoke("Respawn", 2f);        }    }我知道這可能很混亂,但這是我的第一本沒有教程的游戲,所以很難。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 279 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號