签到

05月05日
尚未签到

共有回帖数 0

    晚街听风

    等级:
    比如 fps游戏, 在装弹时,按开火键无效。
    我现在的代码:
    using UnityEngine;
    using System.Collections;
    public class m9_Am : MonoBehaviour {

    public float range=10.0f;

    public float firRate=2.0f;
    public float force=10.0f;
    public float damage=10.0f;
    public int bulletsPerclip=7;
    public float clips=10;
    public float recloadTime=1;//shang2 dan4 shi2 jian1



    int bulletsLeft=0;//can2 dan4 shu4

    private float nextFireTime=1f;
    private int m_LastFrameShot=-1;
    void Start () {

    bulletsLeft = bulletsPerclip;



    }

    void LateUpdate()

    {
    if (Input.GetKeyDown(KeyCode.R))
    {
    animation.Play ("Reload");
    StartCoroutine (Reload());

    }



    if (Input.GetKeyDown(KeyCode.E))
    {}


    if (Input.GetKey (KeyCode.W))
    {
    if(Input.GetKey(KeyCode.LeftShift))
    {}

    }


    if (Input.GetMouseButtonDown (0))

    {
    if(!animation.IsPlaying ("Reload"))
    {


    if(bulletsLeft0)
    {
    animation.Play ("Single_Shot");
    //BroadcastMessage("muzz");
    }
    }


    FireOneShot ();

    {}

    IEnumerator Reload(){

    animation.Play ("Reload");
    yield return new WaitForSeconds(recloadTime);
    if(clips0)
    {
    clips=clips-1;
    bulletsLeft=bulletsPerclip;
    Debug.Log("Reload");
    Debug.Log(clips);
    }
    }




    void FireOneShot(){


    bulletsLeft--;

    if(bulletsLeft==0)
    {
    return;
    }

    }



    }


    现在可以再播放上弹动画时,按鼠标键不会播放射击动画,但是弹夹内的弹药依然会减少。请问怎么写可以让这期间输入的 鼠标键 无效。
    用什么API 或者怎么写命令。
    小白拜谢~~~~~

    楼主 2015-07-07 17:31 回复

共有回帖数 0
  • 回 帖
  • 表情 图片 视频
  • 发表

登录直线网账号

Copyright © 2010~2015 直线网 版权所有,All Rights Reserved.沪ICP备10039589号 意见反馈 | 关于直线 | 版权声明 | 会员须知