using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponSwitch : MonoBehaviour
{
public int weaponID;
public string weaponName;// 在 unity 中显示武器名// Start is called before the first frame updatevoidStart(){}// Update is called once per framevoidUpdate(){// 切换武器if(Input.GetKeyDown(KeyCode.Alpha1))// 按下数字键 1 切换成到状态 1{
weaponID =0;}elseif(Input.GetKeyDown(KeyCode.Alpha2)){
weaponID =1;}elseif(Input.GetKeyDown(KeyCode.Alpha3)){
weaponID =2;}elseif(Input.GetKeyDown(KeyCode.Alpha4)){
weaponID =3;}// 切换武器显示switch(weaponID){case0:
weaponName ="sword";break;case1:
weaponName ="axe";break;case2:
weaponName ="stick";break;case3:
weaponName ="spear";break;}}}