// Use this for initialization void Start() { UnusedClubs.Add(StockClub_Iron); UnusedClubs.Add(StockClub_Putter); StockClub_Iron.SetActive(false); StockClub_Putter.SetActive(false); UnusedWeapons.Add(Rifle_Iron); UnusedWeapons.Add(Rifle_Putter); Rifle_Driver.SetActive(false); Rifle_Iron.SetActive(false); Rifle_Putter.SetActive(false); UnusedGolfClubs.Add(GolfClub_Iron); UnusedGolfClubs.Add(GolfClub_Putter); GolfClub_Driver.GetComponentInChildren <BoxCollider>().enabled = false; GolfClub_Iron.GetComponentInChildren <BoxCollider>().enabled = false; GolfClub_Putter.GetComponentInChildren <BoxCollider>().enabled = false; GolfClub_Driver.SetActive(false); GolfClub_Iron.SetActive(false); GolfClub_Putter.SetActive(false); currentClub = StockClub_Driver; currentWeapon = Rifle_Driver; currentGolfClub = GolfClub_Driver; currentBulletState = BulletStates.DriverBullet; }
void ResetBullet() { Speed = startingSpeed; thisTransform.position = new Vector3(0, 0, -500); currentBulletState = BulletStates.Ready; gameObject.SetActive(false); }
// Use this for initialization void Start() { PlayerManager = GameObject.Find("SmallHuman_001"); playerManagerScript = PlayerManager.GetComponent <Player_Manager>(); Club_Driver = GameObject.Find("GolfClub_Driver_elbow"); Club_Iron = GameObject.Find("GolfClub_Iron_elbow"); Club_Putter = GameObject.Find("GolfClub_Putter_elbow"); Weapon_Driver = GameObject.Find("Weapon_Driver_elbow"); Weapon_Iron = GameObject.Find("Weapon_Iron_elbow"); Weapon_Putter = GameObject.Find("Weapon_Putter_elbow"); UnusedClubs.Add(Club_Iron); UnusedClubs.Add(Club_Putter); Club_Iron.SetActive(false); Club_Putter.SetActive(false); UnusedWeapons.Add(Weapon_Iron); UnusedWeapons.Add(Weapon_Putter); Weapon_Driver.SetActive(false); Weapon_Iron.SetActive(false); Weapon_Putter.SetActive(false); currentClub = Club_Driver; currentWeapon = Weapon_Driver; currentBulletState = BulletStates.DriverBullet; }
//Putter public void SwitchToPutter() { currentClub = StockClub_Putter; currentWeapon = Rifle_Putter; currentGolfClub = GolfClub_Putter; UnusedClubs.Clear(); UnusedClubs.Add(StockClub_Driver); UnusedClubs.Add(StockClub_Iron); UnusedWeapons.Clear(); UnusedWeapons.Add(Rifle_Driver); UnusedWeapons.Add(Rifle_Iron); UnusedGolfClubs.Clear(); UnusedGolfClubs.Add(GolfClub_Driver); UnusedGolfClubs.Add(GolfClub_Iron); currentBulletState = BulletStates.PutterBullet; //playerManagerScript.CurrentClubIsPutter(); }
public void OnBecameInvisible() { currentBulletState = BulletStates.Reset; }
// Update is called once per frame void Update() { if (playerManagerScript.ShowCurrentPlayerState() == Player_Manager.PlayerStatus.Weapon) { currentWeapon.SetActive(true); Club_Driver.SetActive(false); Club_Iron.SetActive(false); Club_Putter.SetActive(false); foreach (GameObject unusedWeapon in UnusedWeapons) { unusedWeapon.SetActive(false); } if (Input.GetKeyDown("joystick button 5")) { Fire(); } } if (playerManagerScript.ShowCurrentPlayerState() == Player_Manager.PlayerStatus.Vanilla) { currentClub.SetActive(true); Weapon_Driver.SetActive(false); Weapon_Iron.SetActive(false); Weapon_Putter.SetActive(false); foreach (GameObject unusedClub in UnusedClubs) { unusedClub.SetActive(false); } } //Driver if (Input.GetKeyDown("joystick button 2")) { currentClub = Club_Driver; currentWeapon = Weapon_Driver; UnusedClubs.Clear(); UnusedClubs.Add(Club_Iron); UnusedClubs.Add(Club_Putter); UnusedWeapons.Clear(); UnusedWeapons.Add(Weapon_Iron); UnusedWeapons.Add(Weapon_Putter); currentBulletState = BulletStates.DriverBullet; playerManagerScript.CurrentClubIsDriver(); } //Iron if (Input.GetKeyDown("joystick button 3")) { currentClub = Club_Iron; currentWeapon = Weapon_Iron; UnusedClubs.Clear(); UnusedClubs.Add(Club_Driver); UnusedClubs.Add(Club_Putter); UnusedWeapons.Clear(); UnusedWeapons.Add(Weapon_Driver); UnusedWeapons.Add(Weapon_Putter); currentBulletState = BulletStates.IronBullet; playerManagerScript.CurrentClubIsIron(); } //Putter if (Input.GetKeyDown("joystick button 1")) { currentClub = Club_Putter; currentWeapon = Weapon_Putter; UnusedClubs.Clear(); UnusedClubs.Add(Club_Driver); UnusedClubs.Add(Club_Iron); UnusedWeapons.Clear(); UnusedWeapons.Add(Weapon_Driver); UnusedWeapons.Add(Weapon_Iron); currentBulletState = BulletStates.PutterBullet; playerManagerScript.CurrentClubIsPutter(); } }