Question by
CrizzieBabe · Nov 11, 2016 at 09:08 PM ·
onmousedownwalkingwalkthirdpersoncontroller
I am trying to adjust the AnimMoveSpeed triggered by OnMouseDown. So that the player walks slower. Please help.
using UnityEngine; using UnityEngine.UI; using System.Collections;
public class Key5 : MonoBehaviour {
public GameObject Dot3;
public GameObject AIThirdPersonController;
public UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter thirdPersonCharacter;
int walkspeed = 2;
int heavyspeed = 1;
void Start()
{
Dot3 = GameObject.Find("Dot3");
Dot3.gameObject.SetActive(false);
thirdPersonCharacter = GetComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();
thirdPersonCharacter.GetComponent("AnimMoveSpeed").walkspeed;
}
void OnMouseDown()
{
Debug.Log ("Clicked on third main key");
gameObject.SetActive(false);
Dot3.gameObject.SetActive(true);
thirdPersonCharacter.GetComponent("AnimMoveSpeed").heavyspeed;
}
}
Comment
Your answer
Follow this Question
Related Questions
I couldn't get the right rotation of transform 0 Answers
GetKeyUp does not get called sometimes. 1 Answer
Walking on walls and roof 0 Answers
OnMouseDown transform problem 0 Answers
OnMouseDown for Xbox Controller 1 Answer