//此方法将盟友召唤到场景中,并返回对盟友的引用 //This method summons the ally into the scene and returns a reference //to the ally public Ally SummonAlly() { //如果无法召唤一个盟友,则返回null值(无) //If an ally can't be summoned, return a value of null (nothing) if (!CanSummonAlly()) { return(null); } //将盟军的位置和旋转与生成点对齐 //Align the ally's position and rotation with the spawn point ally.transform.position = allySpawnPoint.position; ally.transform.rotation = allySpawnPoint.rotation; //启用盟军并告诉其向敌人的目标移动(应该是玩家) //Enable the ally and tell it to move towards the enemy's target (which //should be the player) ally.gameObject.SetActive(true); ally.Move(GameManager.Instance.EnemyTarget.position); //如果有allyImage,请将其关闭 //If there is an allyImage, turn it off if (allyImage != null) { allyImage.enabled = false; } //将对盟友的引用返回给调用者 //Return a reference to the ally back to the caller return(ally); }
public Ally SummonedAlly() { if (!CanSummonAlly()) { return(null); } ally.transform.position = allySpawnPoint.position; ally.transform.rotation = allySpawnPoint.rotation; ally.gameObject.SetActive(true); ally.Move(GameManager.Instance.enemyTarget.position); //Manda o aliado criado ir para a posição do player if (allyImage != null) { allyImage.enabled = false; } return(ally); }
//This method summons the ally into the scene and returns a reference //to the ally public Ally SummonAlly() { //If an ally can't be summoned, return a value of null (nothing) if (!CanSummonAlly()) { return(null); } //Align the ally's position and rotation with the spawn point ally.transform.position = allySpawnPoint.position; ally.transform.rotation = allySpawnPoint.rotation; //Enable the ally and tell it to move towards the enemy's target (which //should be the player) ally.gameObject.SetActive(true); ally.Move(GameManager.Instance.EnemyTarget.position); //If there is an allyImage, turn it off if (allyImage != null) { allyImage.SetActive(false); } //Return a reference to the ally back to the caller return(ally); }