public void SetCurrentState(Robot_BaseState state) { parent_object.GetComponent <Rigidbody2D>().velocity = Vector2.zero; if (current_state != null) { current_state.gameObject.SetActive(false); } current_state = state; current_state.gameObject.SetActive(true); }
//setter public void SetCurrentState(ROBOT_STATES state) { states_enum = state; parent_object.GetComponent <Rigidbody2D>().velocity = Vector2.zero; if (current_state != null) { current_state.gameObject.SetActive(false); } current_state = states[(int)states_enum]; current_state.gameObject.SetActive(true); }