// Use this for initialization void Start () { CharacterController = GetComponent<CharacterController> (); CurrentFuel = MaxFuel; BoostSpeed = MoveSpeed + 20; Slider[] sliders = GameObject.Find("Canvas").GetComponentsInChildren<Slider>(); if (sliders.Length > 1) { fuelBar = sliders[1]; fuelBar.value = 1; } else { Debug.Log("Fuel bar null"); } mechCombat = GetComponent<MechCombat>(); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { cc = animator.transform.parent.gameObject.GetComponent <CharacterController>(); mctrl = animator.transform.parent.gameObject.GetComponent <MechController>(); mcbt = animator.transform.parent.gameObject.GetComponent <MechCombat>(); }
void initComponents() { CharacterController = GetComponent <CharacterController> (); mechCombat = GetComponent <MechCombat>(); animator = transform.Find("CurrentMech").gameObject.GetComponent <Animator>(); }