public void ChangeState(string stateName) { System.Type t = System.Type.GetType(stateName); baseBoatState.Destruct(); baseBoatState = gameObject.AddComponent(t) as BaseBoatState; baseBoatState.Construct(); }
protected virtual void Start() { BackChk = false; boatGear = BoatGear.N; //controller = gameObject.AddComponent<CharacterController>(); rbody = gameObject.GetComponent <Rigidbody>(); thisTransform = gameObject.GetComponent <Transform>(); tempTransform = thisTransform.transform.position; baseBoatState = gameObject.AddComponent <DrivingBoatState>(); baseBoatState.Construct(); boxCol = gameObject.GetComponent <BoxCollider>(); }