/// <summary> /// Start is called before the first frame update /// </summary> private void Start() { controller = GetComponent <CharacterController>(); camera = GetComponentInChildren <Camera>(); stats = GetComponent <PlayerStats>(); interacting = GetComponent <PlayerInteracting>(); myWeapon = hand.GetComponentInChildren <WeaponStats>(); if (singlePlayer != null) { Destroy(this.gameObject); } else { singlePlayer = this.gameObject; } DontDestroyOnLoad(this); }
public void SetPlayer(GameObject newPlayer) { _player = newPlayer; _interactionReceiver = _player.GetComponent <InteractionReceiver>(); _playerInteracting = _player.GetComponent <PlayerInteracting>(); }