Ejemplo n.º 1
0
    private void Start()
    {
        // Check if it's a player's health. And if it's a player, we deactivate his health if it's not ours
        _player = GetComponent <Player>();
        if (_player != null)
        {
            if (!_player.isLocalPlayer)
            {
                enabled = false;
            }
        }

        // Getting network identity to see if it's a body part or a player/ai.
        _networkIdentity = GetComponent <NetworkIdentity>();
        _stateMachine    = GetComponentInParent <AIStateMachine>();
        // If network identity is not found, this is a decapitable body part, so we add it to the list in stateMachine
        if (_stateMachine != null && _networkIdentity == null)
        {
            _stateMachine.AddDecapitableBodyPart(this);
        }
    }