public void Awake() { if (brainType.Equals(BrainType.PLAYER)) { brain = new PlayerBrain(); } else { brain = new CatAIBrain(); } animator = GetComponent <Animator>(); rigidbody = GetComponent <Rigidbody>(); slideSpeedForce = slideSpeed; }
public void changeBrainIfNeeded(BrainType newBrainType) { if (!newBrainType.Equals(brainType)) { brain = createBrainOfType(newBrainType); brainType = newBrainType; } if (brain == null) { Debug.LogWarning("Brain type not set, using NOP"); brain = createBrainOfType(BrainType.NOP); } }