Advertisement
Guest User

Character Resizing

a guest
Feb 6th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class chracaterResizing : MonoBehaviour {
  5.  
  6.     public bool isBig = false;
  7.     public bool isNormal = true;
  8.     public bool isSmall = false;
  9.     public bool isEnabled = false;
  10.  
  11.     public Transform character;
  12.  
  13.     public float bigSize = 10.259745f;
  14.     public float normalSize = 4.259745f;
  15.     public float smallSize = 2.259745f;
  16.  
  17.     void Update () {
  18.  
  19.         if (Input.GetKeyDown (KeyCode.RightBracket) && isEnabled == true && isNormal == true) {
  20.             isNormal = false;
  21.             isBig = true;
  22.         }
  23.  
  24.         if (Input.GetKeyDown (KeyCode.RightBracket) && isEnabled == true && isSmall == true) {
  25.             isSmall = false;
  26.             isNormal = true;
  27.         }
  28.  
  29.         if (Input.GetKeyDown (KeyCode.LeftBracket) && isEnabled == true && isBig == true) {
  30.             isNormal = true;
  31.             isBig = false;
  32.         }
  33.  
  34.         if (Input.GetKeyDown (KeyCode.LeftBracket) && isEnabled == true && isNormal == true) {
  35.             isNormal = false;
  36.             isSmall = true;
  37.         }
  38.  
  39.  
  40.         if (character.GetComponent<characterController>().enabled == true) {
  41.             isEnabled = true;
  42.         }
  43.  
  44.         if (character.GetComponent<characterController>().enabled == false) {
  45.             isEnabled = false;
  46.         }
  47.  
  48.         if (isBig == true) {
  49.             character.GetComponent<Transform>().localScale = new Vector3(bigSize, bigSize);
  50.         }
  51.  
  52.         if (isNormal == true) {
  53.             character.GetComponent<Transform>().localScale = new Vector3(normalSize, normalSize);
  54.         }
  55.  
  56.         if (isSmall == true) {
  57.             character.GetComponent<Transform>().localScale = new Vector3(smallSize, smallSize);
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement