示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     currentAmmo    = ammoCapacity;
     ingameui       = GameObject.FindGameObjectWithTag("InGameUI").GetComponent <InGameUI>();
     myanim         = gameObject.GetComponent <Animator>();
     castPointStart = CastPoint.transform;
     ingameui.SetAmmo(currentAmmo);
 }
示例#2
0
 private void UpdateUI()
 {
     if (!inGameUI)
     {
         return;
     }
     inGameUI.SetAmmo(ammo.GetAmmo(type));
 }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        ingameui.SetAmmo(currentAmmo);
        float horizontal = Input.GetAxis("Horizontal");
        float vertical   = Input.GetAxis("Vertical");

        if (Input.GetButton("Run"))
        {
            if (vertical == 1)
            {
                vertical = 2;
            }
        }
        myanim.SetFloat("walk", vertical / 2);

        if (currentAmmo <= 0 && reload != true && shoot != true)/////////////фикс
        {
            Reload();
        }
        if (GameManager.instance.IsAlive && GameManager.instance.menuOn == false)
        {
            UserInput();
        }
    }