Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Start()
- {
- Cursor.lockState = CursorLockMode.Locked;
- Head = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 Head");
- Neck = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck");
- RightUpperHand = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 R Clavicle/Bip01 R UpperArm");
- RightForearm = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm");
- RightHand = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand");
- LeftUpperHand = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 L Clavicle/Bip01 L UpperArm");
- LeftForearm = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm");
- LeftHand = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 L Clavicle/Bip01 L UpperArm/Bip01 L Forearm/Bip01 L Hand");
- weapon = transform.Find ("Bip01/Bip01 Pelvis/Bip01 Spine/Bip01 Spine1/Bip01 Neck/Bip01 R Clavicle/Bip01 R UpperArm/Bip01 R Forearm/Bip01 R Hand/pistol_glock");
- GetComponent<Animation>()["stand_pistol"].AddMixingTransform(LeftUpperHand);
- GetComponent<Animation>()["stand_pistol"].AddMixingTransform(RightUpperHand);
- GetComponent<Animation>()["stand_pistol"].layer = 10;
- GetComponent<Animation>()["stand_pistol"].enabled = true;
- GetComponent<Animation>()["stand_pistol"].weight = 1.0f;
- GetComponent<Animation>()["stand_pistol"].wrapMode = WrapMode.ClampForever;
- GetComponent<Animation>()["reload_pistol"].AddMixingTransform(LeftUpperHand);
- GetComponent<Animation>()["reload_pistol"].AddMixingTransform(RightUpperHand);
- GetComponent<Animation>()["reload_pistol"].layer = 10;
- GetComponent<Animation>()["reload_pistol"].weight = 1.0f;
- GetComponent<Animation>()["reload_pistol"].speed = 0.25f;
- GetComponent<Animation>()["pda_pistol"].AddMixingTransform(LeftUpperHand);
- GetComponent<Animation>()["pda_pistol"].AddMixingTransform(RightUpperHand);
- GetComponent<Animation>()["pda_pistol"].layer = 10;
- GetComponent<Animation>()["pda_pistol"].weight = 1.0f;
- GetComponent<Animation>()["pda_pistol"].speed = 0.25f;
- }
- void Update()
- {
- if (Input.GetKey(KeyCode.W))
- {
- if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
- {
- GetComponent<Animation>()["walk_forward"].speed = 2.5f;
- }
- else
- {
- GetComponent<Animation>()["walk_forward"].speed = 1.5f;
- }
- if (!GetComponent<Animation>().IsPlaying("walk_forward"))
- {
- GetComponent<Animation>().CrossFade("walk_forward");
- }
- }
- else if (Input.GetKey(KeyCode.A))
- {
- if (!GetComponent<Animation>().IsPlaying("walk_left"))
- {
- GetComponent<Animation>().CrossFade("walk_left");
- }
- }
- else if (Input.GetKey(KeyCode.D))
- {
- if (!GetComponent<Animation>().IsPlaying("walk_right"))
- {
- GetComponent<Animation>().CrossFade("walk_right");
- }
- }
- else if (Input.GetKey(KeyCode.S))
- {
- GetComponent<Animation>()["walk_forward"].speed = -1.5f;
- if (!GetComponent<Animation>().IsPlaying("walk_forward"))
- {
- GetComponent<Animation>().CrossFade("walk_forward");
- }
- }
- if ((reload)&&(!GetComponent<Animation>().IsPlaying("reload_pistol")))
- {
- reload = false;
- }
- if ((!reload)&&(!pda))
- {
- GetComponent<Animation>().Play("stand_pistol");
- if (Input.GetKey(KeyCode.R))
- {
- reload = true;
- GetComponent<Animation>().Play("reload_pistol");
- }
- if (Input.GetKey(KeyCode.F))
- {
- pda = true;
- GetComponent<Animation>().Play("pda_pistol");
- }
- }
- if ((pda) && (!GetComponent<Animation>().IsPlaying("pda_pistol")))
- {
- pda = false;
- }
- if (((Input.GetKey(KeyCode.F))) && (GetComponent<Animation>()["pda_pistol"].normalizedTime > 0.45f))
- {
- GetComponent<Animation>()["pda_pistol"].normalizedTime = 0.46f;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment