//void OnDrawGizmos() //{ // Gizmos.DrawCube(new Vector2(patrolTargetX, transform.position.y), Vector3.one/3); //} public void changeState(dinoState newState) { lastState = currentState; currentState = newState; if (newState == dinoState.patrol) { getNewPatrolTarget(); } }
void Start() { radius = GetComponentInChildren <CircleCollider2D>().radius *transform.localScale.x; animator = GetComponent <Animator>(); goundedChecker = GetComponent <isGroundedRaycaster>(); wallBuffer = GetComponent <BoxCollider2D>().bounds.extents.x *transform.lossyScale.x + 0.03f; currentState = dinoState.patrol; lastState = currentState; getNewPatrolTarget(); StartCoroutine("searchAndCharge"); StartCoroutine("patrol"); }