private void Awake() { //init: animator = GetComponent <Animator>(); input = GetComponent <AbstractCharacterInput>(); if (input == null) { input = gameObject.AddComponent <AbstractCharacterInput>(); } physics = GetComponent <CharacterPhysics>(); if (physics == null) { physics = gameObject.AddComponent <CharacterPhysics>(); } view = GetComponent <AbstractCameraController>(); if (view == null) { view = gameObject.AddComponent <AbstractCameraController>(); } interaction.init(); ResetAnimatorController(); }
/// <summary> /// Add a <see cref="AbstractCameraController"/> to this <see cref="Chart"/>. /// Warning: the <see cref="Chart"/> is not the owner of the controller. Disposing /// the chart thus just unregisters the controllers, but does not handle /// stopping and disposing controllers. /// </summary> public void addController(AbstractCameraController controller) { controller.Register(this); _controllers.Add(controller); }
public void removeController(AbstractCameraController controller) { controller.Unregister(this); _controllers.Remove(controller); }