/// <summary> /// Inizializzo la state machine e posiziono la unit in uno spawnPoint. /// </summary> void setupStateMachine() { SM = GetComponent <UnitStateMachine>(); if (SM == null) { Debug.LogError(string.Format("SM not found!")); return; } SM.Setup(this); transform.position = GM.I.GetRandomSpownPosition(Vector3.zero); SM.CurrentState = UnitState.idle; }
public void StateMachineSetUp() { SM = GetComponent <UnitStateMachine>(); SM.SetUp(this); if (SM == null) { Debug.LogError("SM not found"); } else { SM.CurrentState = UnitState.idle; } }
protected void Update() { SM = GetComponent <UnitStateMachine>(); //GetComponentInChildren<TextBox>().SetText(SM.CurrentState.ToString()); }