private void Start() { GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController"); if (gameControllerObject != null) { _gameController = gameControllerObject.GetComponent <GameController>(); } if (_gameController == null) { Debug.Log("Cannot find 'GameController' script"); } GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); if (playerObject != null) { _player = playerObject.GetComponent <PlayerInputControl>(); } if (_player == null) { Debug.Log("Cannot find 'GameController' script"); } }
void OnTriggerEnter(Collider other) { // if (other.name.Equals("player")) if (other.gameObject.CompareTag("Player")) { GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController"); GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); if (gameControllerObject != null) { _gameController = gameControllerObject.GetComponent <GameController>(); _player = playerObject.GetComponent <PlayerInputControl>(); } if (gameControllerObject == null) { Debug.Log("Cannot find 'game controller' script"); } Debug.Log("!!"); _player.protecter.gameObject.SetActive(true); Destroy(gameObject); } }
void Start() { _Animation = GetComponentInChildren <Animation>(); _CharacterController = GetComponent <CharacterController>(); _HeroAnimationControl = GetComponent <HeroAnimationControl>(); _HeroAttackControl = GetComponent <HeroAttackControl>(); _PlayerInputControl = GetComponent <PlayerInputControl>(); _HeroProperty = GetComponent <HeroProperty>(); }
void Start() { //变量初始化 PIC = GetComponent <PlayerInputControl>(); inputEffective = true; InputedMovements = new List <string>(); MasteredComboSkills = new List <ComboSkill>(); MasteredComboSkills.Add(c1); MasteredComboSkills.Add(c2); tempPossibleComboSkills = new List <ComboSkill>(MasteredComboSkills); }
//player stats and info private void Awake() { if (player == null) { DontDestroyOnLoad(gameObject); player = this; } else if (player != this) { Destroy(gameObject); } }
private void Start() { GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); if (playerObject != null) { _player = playerObject.GetComponent <PlayerInputControl>(); this.speed = _player.speed; this.yPosition = _player.yPosition; this.angle = _player.angle; } if (playerObject == null) { Debug.Log("Cannot find 'player' script"); } }
void OnTriggerEnter(Collider other) { // Debug.Log(" i have detected the collision "); // if (other.name.Equals("player")) if (other.gameObject.CompareTag("Player")) { GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); if (playerObject != null) { _player = playerObject.GetComponent <PlayerInputControl>(); } if (playerObject == null) { Debug.Log("Cannot find 'player' script"); } Destroy(this.gameObject); // change the type of the spaceship of player curr_player_type = _player.getPlayer_type(); if (curr_player_type == 0) { _player.GetComponent <MeshFilter>().mesh = upgradeMesh_1; _player.GetComponent <Renderer>().material = upgradeMaterial_1; _player.setPlayer_type(1); } if (curr_player_type == 1) { _player.GetComponent <MeshFilter>().mesh = upgradeMesh_2; _player.GetComponent <Renderer>().material = upgradeMaterial_2; _player.setPlayer_type(2); } } }
private void OnTriggerEnter(Collider other) { // if (other.name.Equals("player")) if (other.gameObject.CompareTag("Player")) { GameObject playerObject = GameObject.FindGameObjectWithTag("Player"); if (playerObject != null) { _player = playerObject.GetComponent <PlayerInputControl>(); } if (playerObject == null) { Debug.Log("Cannot find 'player' script"); } Destroy(this.gameObject); // change the type of the bolt_type of player _player.setBolt_type(bolt_type); } }
void Awake() { pic = GetComponent <PlayerInputControl>(); psc = GetComponent <PlayerStatsCounter>(); trans = transform; }