void Start()
    {
        // fetch components on the same gameObject
        m_Controller = GetComponent <CharacterController>();
        // DebugUtility.HandleErrorIfNullGetComponent<CharacterController, PlayerCharacterController>(m_Controller, this, gameObject);

        m_InputHandler = GetComponent <PlayerInputHandler>();
        // DebugUtility.HandleErrorIfNullGetComponent<PlayerInputHandler, PlayerCharacterController>(m_InputHandler, this, gameObject);

        m_WeaponsManager = GetComponent <PlayerWeaponsManager>();
        // DebugUtility.HandleErrorIfNullGetComponent<PlayerWeaponsManager, PlayerCharacterController>(m_WeaponsManager, this, gameObject);

        m_Health = GetComponent <Health>();
        // DebugUtility.HandleErrorIfNullGetComponent<Health, PlayerCharacterController>(m_Health, this, gameObject);

        m_Actor = GetComponent <Actor>();
        // DebugUtility.HandleErrorIfNullGetComponent<Actor, PlayerCharacterController>(m_Actor, this, gameObject);

        m_Animator = GetComponent <Animator>();

        network = GameObject.FindObjectOfType <NetworkSocket1>();

        m_Controller.enableOverlapRecovery = true;

        m_Health.onDie += OnDie;

        // force the crouch state to false when starting
        SetCrouchingState(false, true);
        UpdateCharacterHeight(true);
    }
Beispiel #2
0
 void Awake()
 {
     network = GetComponent <NetworkSocket1>();
     if (!network)
     {
         network = GetComponentInParent <NetworkSocket1>();
     }
 }