Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Thomas Baca
- 01.13.2012
- Loadout Script by Thomas Baca
- /// <summary>
- /// Loadout armor.
- /// This is a network creating system for customizable armor for
- the players avatar. Once the player selects pieces they like they hit
- the purchase button and it subtracts the players credits to pay for the armor
- The player must pay for the armor every time they make a change that way it forces
- players to think strategically what they want to be in the game. For example if the player
- wants to be a stealthy assassin a cloak armor set would be used along with the right weapons.
- Weapons will be on another script since they act differently than static armor pieces.
- Give all credit to Thomas Baca if you use this Script.
- /// </summary>
- Email : ThomasAnthonyBaca@gmail.com
- Phone : (602)486-1874
- * */
- using UnityEngine;
- using System.Collections;
- public class LoadoutArmor : MonoBehaviour
- {
- //Public Variables to be used
- public NetworkView[] Helmet;
- public NetworkView[] ChestPlate;
- public NetworkView[] LShoulder;
- public NetworkView[] RShoulder;
- public NetworkView[] Boots;
- public NetworkView[] Bones;
- private int helm;
- private int chest;
- private int LeftShoulder;
- private int RightShoulder;
- private int boots;
- // Use this for initialization
- void Start ()
- {
- //Get the users selection of armor set
- helm = PlayerPrefs.GetInt("Helmet");
- chest = PlayerPrefs.GetInt("Chest");
- LeftShoulder = PlayerPrefs.GetInt("Lshoulder");
- RightShoulder = PlayerPrefs.GetInt("Rshoulder");
- boots = PlayerPrefs.GetInt("boots");
- //then child each piece to the right bone
- if(networkView.isMine)
- {
- ///Helmet Loadout
- for(int i = 0; i < Helmet.Length; i++)
- {
- if(i == helm)
- {
- NetworkView TempHelm = (NetworkView) Network.Instantiate(Helmet[i].gameObject
- ,Bones[0].transform.position
- ,Bones[0].transform.rotation,0);
- TempHelm.transform.parent = Bones[0].gameObject.transform;
- }
- }
- ///Left Shoulder
- for(int i = 0; i < LShoulder.Length; i++)
- {
- if(i == LeftShoulder)
- {
- NetworkView TempHelm = (NetworkView) Network.Instantiate(LShoulder[i].gameObject
- ,Bones[1].transform.position
- ,Bones[1].transform.rotation,0);
- TempHelm.transform.parent = Bones[1].gameObject.transform;
- }
- }
- ///Right Shoulder
- for(int i = 0; i < RShoulder.Length; i++)
- {
- if(i == RightShoulder)
- {
- NetworkView TempHelm = (NetworkView) Network.Instantiate(RShoulder[i].gameObject
- ,Bones[2].transform.position
- ,Bones[2].transform.rotation,0);
- TempHelm.transform.parent = Bones[2].gameObject.transform;
- }
- }
- ///Chest
- for(int i = 0; i < ChestPlate.Length; i++)
- {
- if(i == chest)
- {
- NetworkView TempHelm = (NetworkView) Network.Instantiate(ChestPlate[i].gameObject
- ,Bones[3].transform.position
- ,Bones[3].transform.rotation,0);
- TempHelm.transform.parent = Bones[3].gameObject.transform;
- }
- }
- ///Boots
- for(int i = 0; i < Boots.Length; i++)
- {
- if(i == boots)
- {
- NetworkView TempHelm = (NetworkView) Network.Instantiate(Boots[i].gameObject
- ,Bones[4].transform.position
- ,Bones[4].transform.rotation,0);
- TempHelm.transform.parent = Bones[4].gameObject.transform;
- NetworkView TempHelm2 = (NetworkView) Network.Instantiate(Boots[i].gameObject
- ,Bones[5].transform.position
- ,Bones[5].transform.rotation,0);
- TempHelm2.transform.parent = Bones[5].gameObject.transform;
- }
- }
- }
- }
- // Update is called once per frame
- void Update ()
- {
- //////////////////////////////////////////////////////////////////
- //based on the armor give the player abilities and change values//
- //such as movement speed, jumping, etc. //
- //////////////////////////////////////////////////////////////////
- }
- }
Add Comment
Please, Sign In to add comment