private void Update() { VerifyLocalController(); for (int i = 0; i < tools.Length; i++) { if (tools[i] != null) { tools[i].Update(); } } if (tools[1].UseAble() && !battleChat.IsChatting && custom_inputs.Instance.GetButtonDown(input[0]) && localController != null && localController.CanControl()) { tools[1].Use(); if (tools[0].UseAble()) { tools[1].AddActiveItem(tools[0].GetActiveItem()); tools[0].ResetSlot(); } } if (tools[1].UseAble() && tools[0].UseAble() && !battleChat.IsChatting && custom_inputs.Instance.GetButtonDown(input[1]) && localController != null && localController.CanControl()) { ActiveItemData activeItem = tools[1].GetActiveItem(); tools[1].ResetSlot(); tools[1].AddActiveItem(tools[0].GetActiveItem()); tools[0].ResetSlot(); tools[0].AddActiveItem(activeItem); GameObject gameObject = GameObject.Find("Me"); if (null != gameObject) { AudioSource component = gameObject.GetComponent <AudioSource>(); if (component != null) { component.PlayOneShot(sndItemSwap); } } } }
private bool CanFire() { return(localController.CanControl()); }
public void Update() { deltaTime += Time.deltaTime; if (desc != null && !battleChat.IsChatting && controller != null && controller.IsDead) { switch (desc.name) { case "respawn": Respawn(); break; case "just_respawn": JustRespawn(); break; } } keyPressed = custom_inputs.Instance.GetButtonDown(input); if (desc != null && !battleChat.IsChatting && keyPressed && controller != null && controller.CanControl()) { switch (desc.name) { case "auto_reload": active = !active; break; case "heal": if (!Heal(100)) { ErrorSound(); } break; case "heal50": if (!Heal(50)) { ErrorSound(); } break; case "heal30": if (!Heal(30)) { ErrorSound(); } break; case "assault_ammo": if (!ChargeAssaultAmmo()) { ErrorSound(); } break; case "speedup": if (!SpeedUp()) { ErrorSound(); } break; case "heartbeat_radar": if (!HeartbeatDetect()) { ErrorSound(); } break; case "grenade_ammo": if (!ChargeGrenadeAmmo()) { ErrorSound(); } break; case "pistol_ammo": if (!ChargePistolAmmo()) { ErrorSound(); } break; case "heavy_ammo": if (!ChargeHeavyAmmo()) { ErrorSound(); } break; case "sniper_ammo": if (!ChargeSniperAmmo()) { ErrorSound(); } break; case "submachine_ammo": if (!ChargeSubmachineAmmo()) { ErrorSound(); } break; case "auto_heal": active = !active; break; case "just_respawn": active = !active; break; } } }