void Awake() { if (m_CharacterInput == null) { m_CharacterInput = GetComponent <CharacterInput>(); } }
/// <summary> /// Initialization on load. Must be manually called /// </summary> /// <param name="transform">Transform of the game object, on which this class will do work</param> public virtual void Awake(Transform transform) { cachedTransform = transform; normalizedVerticalSpeed = 0.0f; m_CharacterInput = cachedTransform.GetComponent <CharacterInput>(); m_CharacterBrain = cachedTransform.GetComponent <CharacterBrain>(); characterController = cachedTransform.GetComponent <OpenCharacterController>(); characterController.collision += OnCollision; if (m_TerminalVelocity > 0.0f) { m_TerminalVelocity = -m_TerminalVelocity; } m_Gravity = UnityPhysics.gravity.y; }
/// <summary> /// Initialization on load. This method must be manually called. /// </summary> /// <param name="transform">Transform of the game object, on which this class will do work</param> public virtual void Awake(Transform transform) { cachedTransform = transform; normalizedVerticalSpeed = 0.0f; m_CharacterInput = cachedTransform.GetComponent <CharacterInput>(); m_CharacterBrain = cachedTransform.GetComponent <CharacterBrain>(); characterController = cachedTransform.GetComponent <OpenCharacterController>(); characterController.collision += OnCollision; if (m_TerminalVelocity > 0.0f) { m_TerminalVelocity = -m_TerminalVelocity; } m_Gravity = UnityPhysics.gravity.y; // Calculate the minimum surface normal for moving platforms var vector = Quaternion.Euler(k_MaxPlatformAngle, 0.0f, 0.0f) * Vector3.up; m_MovingPlatforms.minNormalY = vector.y; }