Guest User

Untitled

a guest
May 24th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.88 KB | None | 0 0
  1. /*
  2.  Thomas Baca
  3.  01.13.2012
  4.  
  5.  Loadout Script by Thomas Baca
  6.  /// <summary>
  7.  /// Loadout armor.
  8.  /// This is a network creating system for customizable armor for
  9.  the players avatar. Once the player selects pieces they like they hit
  10.  the purchase button and it subtracts the players credits to pay for the armor
  11.  The player must pay for the armor every time they make a change that way it forces
  12.  players to think strategically what they want to be in the game. For example if the player
  13.  wants to be a stealthy assassin a cloak armor set would be used along with the right weapons.
  14.  Weapons will be on another script since they act differently than static armor pieces.
  15.  Give all credit to Thomas Baca if you use this Script.
  16.  /// </summary>
  17.  
  18.  Email : ThomasAnthonyBaca@gmail.com
  19.  Phone : (602)486-1874
  20.  * */
  21.  
  22.  
  23. using UnityEngine;
  24. using System.Collections;
  25.  
  26. public class LoadoutArmor : MonoBehaviour
  27. {
  28.     //Public Variables to be used
  29.     public NetworkView[] Helmet;
  30.     public NetworkView[] ChestPlate;
  31.     public NetworkView[] LShoulder;
  32.     public NetworkView[] RShoulder;
  33.     public NetworkView[] Boots;
  34.     public NetworkView[] Bones;
  35.    
  36.     private int helm;
  37.     private int chest;
  38.     private int LeftShoulder;
  39.     private int RightShoulder;
  40.     private int boots;
  41.    
  42.     // Use this for initialization
  43.     void Start ()
  44.     {
  45.             //Get the users selection of armor set
  46.             helm = PlayerPrefs.GetInt("Helmet");
  47.             chest = PlayerPrefs.GetInt("Chest");
  48.             LeftShoulder = PlayerPrefs.GetInt("Lshoulder");
  49.             RightShoulder = PlayerPrefs.GetInt("Rshoulder");
  50.             boots = PlayerPrefs.GetInt("boots");
  51.        
  52.             //then child each piece to the right bone
  53.             if(networkView.isMine)
  54.             {
  55.             ///Helmet Loadout
  56.             for(int i = 0; i < Helmet.Length; i++)
  57.             {
  58.                 if(i == helm)
  59.                 {
  60.                     NetworkView TempHelm = (NetworkView) Network.Instantiate(Helmet[i].gameObject
  61.                         ,Bones[0].transform.position
  62.                         ,Bones[0].transform.rotation,0);
  63.                     TempHelm.transform.parent = Bones[0].gameObject.transform;
  64.                 }
  65.             }
  66.        
  67.             ///Left Shoulder
  68.             for(int i = 0; i < LShoulder.Length; i++)
  69.             {
  70.                 if(i == LeftShoulder)
  71.                 {
  72.                     NetworkView TempHelm = (NetworkView) Network.Instantiate(LShoulder[i].gameObject
  73.                         ,Bones[1].transform.position
  74.                         ,Bones[1].transform.rotation,0);
  75.                     TempHelm.transform.parent = Bones[1].gameObject.transform;
  76.                 }
  77.             }
  78.        
  79.             ///Right Shoulder
  80.             for(int i = 0; i < RShoulder.Length; i++)
  81.             {
  82.                 if(i == RightShoulder)
  83.                 {
  84.                     NetworkView TempHelm = (NetworkView) Network.Instantiate(RShoulder[i].gameObject
  85.                         ,Bones[2].transform.position
  86.                         ,Bones[2].transform.rotation,0);
  87.                     TempHelm.transform.parent = Bones[2].gameObject.transform;
  88.                 }
  89.             }
  90.        
  91.             ///Chest
  92.             for(int i = 0; i < ChestPlate.Length; i++)
  93.             {
  94.                 if(i == chest)
  95.                 {
  96.                     NetworkView TempHelm = (NetworkView) Network.Instantiate(ChestPlate[i].gameObject
  97.                         ,Bones[3].transform.position
  98.                         ,Bones[3].transform.rotation,0);
  99.                     TempHelm.transform.parent = Bones[3].gameObject.transform;
  100.                 }
  101.             }
  102.            
  103.             ///Boots
  104.             for(int i = 0; i < Boots.Length; i++)
  105.             {
  106.                 if(i == boots)
  107.                 {
  108.                     NetworkView TempHelm = (NetworkView) Network.Instantiate(Boots[i].gameObject
  109.                         ,Bones[4].transform.position
  110.                         ,Bones[4].transform.rotation,0);
  111.                     TempHelm.transform.parent = Bones[4].gameObject.transform;
  112.                
  113.                     NetworkView TempHelm2 = (NetworkView) Network.Instantiate(Boots[i].gameObject
  114.                         ,Bones[5].transform.position
  115.                         ,Bones[5].transform.rotation,0);
  116.                     TempHelm2.transform.parent = Bones[5].gameObject.transform;
  117.                 }
  118.             }
  119.         }
  120.     }
  121.    
  122.     // Update is called once per frame
  123.     void Update ()
  124.     {
  125.         //////////////////////////////////////////////////////////////////
  126.         //based on the armor give the player abilities and change values//
  127.         //such as movement speed, jumping, etc.                         //
  128.         //////////////////////////////////////////////////////////////////
  129.     }
  130. }
Add Comment
Please, Sign In to add comment