//TODO : drag and drop disable for enemies public void addEnemyChampionInstance( string spawnName, Vector3 spawnPosistion, GameObject championInstance, int prefabIndex) { //UnityEngine.Debug.Log(spawnName + championInstance + prefabIndex); ChampInstanceData newChampInstance = new ChampInstanceData(spawnName, spawnPosistion, championInstance, prefabIndex); if (newChampInstance != null) { Enemies.Add(newChampInstance); } }
public void addChampionInstance( string spawnName, Vector3 spawnPosistion, GameObject championInstance, int prefabIndex, bool fighter) { ChampInstanceData newChampInstance = new ChampInstanceData(spawnName, spawnPosistion, championInstance, prefabIndex); if (isThereAnyFreeSpawnPoints() && newChampInstance != null) { if (fighter) { Fighters.Add(newChampInstance); actualFighterNb += 1; } else { Substitutes.Add(newChampInstance); actualSubstitutesNb += 1; } } }
public void setSpawner(string spawnNameFrom, string spawnNameTo, Vector3 spawnerPositionTo, bool ToIsFighterSpawn) { if (ToIsFighterSpawn && findInFightersByName(spawnNameFrom)) // From fighter spawn to fighter spawn { ChampInstanceData champData = findInFightersByNameprivate(spawnNameFrom); champData.SpawnName = spawnNameTo; champData.ChampionInstance.transform.position = spawnerPositionTo; } else if (!ToIsFighterSpawn && findInFightersByName(spawnNameFrom)) // From Fighter to Sub { ChampInstanceData champData = findInFightersByNameprivate(spawnNameFrom); Fighters.Remove(champData); champData.SpawnName = spawnNameTo; champData.ChampionInstance.transform.position = spawnerPositionTo; Substitutes.Add(champData); actualFighterNb -= 1; actualSubstitutesNb += 1; } else if (ToIsFighterSpawn && findInSubstitutesByName(spawnNameFrom))// From Sub to Fighter { ChampInstanceData champData = findInSubstitutesByNameprivate(spawnNameFrom); Substitutes.Remove(champData); champData.SpawnName = spawnNameTo; champData.ChampionInstance.transform.position = spawnerPositionTo; Fighters.Add(champData); actualFighterNb += 1; actualSubstitutesNb -= 1; } else if (findInSubstitutesByName(spawnNameFrom))// From Sub to sub { ChampInstanceData champData = findInSubstitutesByNameprivate(spawnNameFrom); champData.SpawnName = spawnNameTo; champData.ChampionInstance.transform.position = spawnerPositionTo; } // this.printME(); }
public void switchSpawners(GameObject spawnerFrom, GameObject spawnerTo) { bool FromIsFighterSpawn = spawnerFrom.GetComponent <ChampionSpawner>().FightingSpawner; bool ToIsFighterSpawn = spawnerTo.GetComponent <ChampionSpawner>().FightingSpawner; if (FromIsFighterSpawn && ToIsFighterSpawn) { // both fighter spawns ChampInstanceData champDataFrom = findInFightersByNameprivate(spawnerFrom.name); ChampInstanceData champDataTo = findInFightersByNameprivate(spawnerTo.name); champDataFrom.SpawnName = spawnerTo.name; champDataFrom.ChampionInstance.transform.position = spawnerTo.transform.position; champDataTo.SpawnName = spawnerFrom.name; champDataTo.ChampionInstance.transform.position = spawnerFrom.transform.position; } else if (!FromIsFighterSpawn && !ToIsFighterSpawn) { // both Sub spawns ChampInstanceData champDataFrom = findInSubstitutesByNameprivate(spawnerFrom.name); ChampInstanceData champDataTo = findInSubstitutesByNameprivate(spawnerTo.name); champDataFrom.SpawnName = spawnerTo.name; champDataFrom.ChampionInstance.transform.position = spawnerTo.transform.position; champDataTo.SpawnName = spawnerFrom.name; champDataTo.ChampionInstance.transform.position = spawnerFrom.transform.position; } else if (FromIsFighterSpawn && !ToIsFighterSpawn) { // From Fighter to Sub ChampInstanceData champDataFrom = findInFightersByNameprivate(spawnerFrom.name); Fighters.Remove(champDataFrom); champDataFrom.SpawnName = spawnerTo.name; champDataFrom.ChampionInstance.transform.position = spawnerTo.transform.position; ChampInstanceData champDataTo = findInSubstitutesByNameprivate(spawnerTo.name); Substitutes.Remove(champDataTo); champDataTo.SpawnName = spawnerFrom.name; champDataTo.ChampionInstance.transform.position = spawnerFrom.transform.position; Substitutes.Add(champDataFrom); Fighters.Add(champDataTo); } else { // From Sub to Fighter ChampInstanceData champDataFrom = findInSubstitutesByNameprivate(spawnerFrom.name); Substitutes.Remove(champDataFrom); champDataFrom.SpawnName = spawnerTo.name; champDataFrom.ChampionInstance.transform.position = spawnerTo.transform.position; ChampInstanceData champDataTo = findInFightersByNameprivate(spawnerTo.name); Fighters.Remove(champDataTo); champDataTo.SpawnName = spawnerFrom.name; champDataTo.ChampionInstance.transform.position = spawnerFrom.transform.position; Fighters.Add(champDataFrom); Substitutes.Add(champDataTo); } // this.printME(); }