private void StartConversation() { if (lightningUnit == null || earthUnit == null) { lightningUnit = GameObject.FindGameObjectWithTag("LightningUnit").GetComponent <LightningUnit>(); earthUnit = GameObject.FindGameObjectWithTag("EarthUnit").GetComponent <EarthUnit>(); } inCinematic = true; conversationPlane.SetActive(true); currentSpeachCount = 0; if (currentConversation.dialogue[currentSpeachCount].speaker == Speach.Speaker.Clade) { camController.LookAtPosition(earthUnit.transform.position); lightningProfile.SetActive(false); earthProfile.SetActive(true); } else if (currentConversation.dialogue[currentSpeachCount].speaker == Speach.Speaker.Gen) { camController.LookAtPosition(lightningUnit.transform.position); lightningProfile.SetActive(true); earthProfile.SetActive(false); } tmp.text = currentConversation.dialogue[currentSpeachCount].text; currentSpeachCount++; }
// Spawn's the lightning unit and returns a reference to it, takes in an optional spawnHex public Unit SpawnLightningUnit(Hex spawnHex = null) { // use spawn points by default if (spawnHex == null) { GameObject lightningGO = GameObject.FindGameObjectWithTag("LightningUnitSpawn"); if (lightningGO) { Hex spawnHexLightning = lightningGO.transform.parent.GetComponent <Hex>(); Vector3 spawnPosLightning = spawnHexLightning.transform.position; spawnPosLightning.y = spawnYLevel; lightningUnit = Instantiate(Resources.Load <LightningUnit>("PlayerCharacters/LightningUnit"), spawnPosLightning, Quaternion.identity); lightningUnit.Spawn(spawnHexLightning); lightningUnit.GetComponent <OverworldFollower>().Init(); lightningUnit.OnDeath += PlayerUnitDied; lightningDead = false; return(lightningUnit); } else { Debug.LogError("No lightning spawn point found!"); return(null); } } else { // spawn at checkpoint pos Vector3 spawnPosLightning = spawnHex.transform.position; spawnPosLightning.y = spawnYLevel; lightningUnit = Instantiate(Resources.Load <LightningUnit>("PlayerCharacters/LightningUnit"), spawnPosLightning, Quaternion.identity); lightningUnit.Spawn(spawnHex); lightningUnit.GetComponent <OverworldFollower>().Init(); lightningUnit.OnDeath += PlayerUnitDied; lightningDead = false; return(lightningUnit); } }
public void Init() { // set default values for local fields canInteract = false; myTurn = false; trackingKills = false; encounterKillLimit = 0; encounterHasBoss = false; encounterBossDamage = 0; encounterBossDamageGoal = 0; encounterKillCount = 0; lightningDead = false; earthDead = false; AI_controller = GameObject.FindGameObjectWithTag("AI_Controller").GetComponent <AI_Controller>(); // Subscribe to necessary delegates Manager.instance.TurnController.PlayerTurnEvent += TurnEvent; // only care about our turn, not the AI's Manager.instance.StateController.OnGameStateChanged += GameStateChanged; GameObject earthGO = GameObject.FindGameObjectWithTag("EarthUnit"); if (earthGO) { earthUnit = GameObject.FindGameObjectWithTag("EarthUnit").GetComponent <EarthUnit>(); } else { Debug.LogError("No Earth unit found!"); } GameObject lightningGO = GameObject.FindGameObjectWithTag("LightningUnit"); if (lightningGO) { lightningUnit = GameObject.FindGameObjectWithTag("LightningUnit").GetComponent <LightningUnit>(); } else { Debug.LogError("No lightning unit found!"); } // Initialise the ToolTip to find the lightning and earth unit ToolTip.instance.Init(); lightningGO.GetComponent <OverworldFollower>().Init(); earthGO.GetComponent <OverworldFollower>().Init(); }
public void Init() { GameObject earthGO = GameObject.FindGameObjectWithTag("EarthUnit"); if (earthGO) { earthUnit = GameObject.FindGameObjectWithTag("EarthUnit").GetComponent <EarthUnit>(); } else { Debug.LogError("No Earth unit found!"); } GameObject lightningGO = GameObject.FindGameObjectWithTag("LightningUnit"); if (lightningGO) { lightningUnit = GameObject.FindGameObjectWithTag("LightningUnit").GetComponent <LightningUnit>(); } else { Debug.LogError("No lightning unit found!"); } }