private void InitHand(StoneHatchet stone, int damage, int durable, GunType gunType, GameObject icon) { stone.Id = index++; stone.Damage = damage; stone.Durable = durable; stone.WeapenType = gunType; stone.ToolBarIcon = icon; }
/// <summary> /// 实例化武器. /// </summary> public GameObject CreateGun(string weaponName, GameObject item) { GameObject weapon = null; switch (weaponName) { case "Assault Rifle": weapon = GameObject.Instantiate <GameObject>(prefab_AssaultRifle, m_Transform); InitWeapon(weapon, 100, 20, GunType.AssaultRifle, item); break; case "Shotgun": weapon = GameObject.Instantiate <GameObject>(prefab_Shotgun, m_Transform); InitWeapon(weapon, 200, 20, GunType.Shotgun, item); break; case "Wooden Bow": weapon = GameObject.Instantiate <GameObject>(prefab_WoodenBow, m_Transform); InitWeapon(weapon, 70, 20, GunType.WoodenBow, item); break; case "Wooden Spear": weapon = GameObject.Instantiate <GameObject>(prefab_WoodenSpear, m_Transform); InitWeapon(weapon, 50, 20, GunType.WoodenSpear, item); break; case "Building Plan": weapon = GameObject.Instantiate <GameObject>(prefab_BuildingPlan, m_Transform); break; case "Stone Hatchet": weapon = GameObject.Instantiate <GameObject>(prefab_StoneHatchet, m_Transform); StoneHatchet sh = weapon.GetComponent <StoneHatchet>(); sh.Damage = 100; sh.Durable = 20; sh.M_GunType = GunType.StoneHatchet; sh.ToolBarItem = item; break; } return(weapon); }