/// <summary> /// Called when starting a new game. Sets the starting values. /// </summary> private void NewGameClicked() { currentMission.value = startMission; mapIndex.value = 0; loadMapID.value = startMission.maps[0].uuid; currentPlayTime.value = 0; saveController.ResetCurrentData(); squad1.values.Clear(); squad2.values.Clear(); for (int i = 0; i < startingCharacters.Length; i++) { playerData.stats.Add(new StatsContainer(startingCharacters[i])); playerData.inventory.Add(new InventoryContainer(classWheel.GetWpnSkillFromLevel(startingCharacters[i].charData.startClassLevels), startingCharacters[i].inventory)); playerData.skills.Add(new SkillsContainer(classWheel.GetSkillsFromLevel(startingCharacters[i].charData.startClassLevels, startingCharacters[i].charData.startClass, startingCharacters[i].level))); playerData.baseInfo.Add(new SupportContainer(null)); squad1.values.Add(new PrepCharacter(i)); } for (int i = 0; i < startItems.Length; i++) { playerData.items.Add(new InventoryItem(startItems[i])); } for (int i = 0; i < startUpgrade.Length; i++) { playerData.upgrader.AddEntry(new UpgradeItem(startUpgrade[i])); } for (int i = 0; i < otherMissions.Length; i++) { playerData.missions.Add(new MissionProgress(otherMissions[i].uuid)); } InputDelegateController.instance.TriggerSceneChange(MenuMode.NONE, "LoadingScreen"); }
/// <summary> /// Spawns a player character on the map. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="stats"></param> /// <param name="inventory"></param> /// <param name="skills"></param> public PlayerMove SpawnPlayerCharacter(SpawnData pos, bool addToPrep, bool active, bool cursorHover) { Transform playerTransform = Instantiate(playerPrefab, battleMap.playerParent); PlayerMove tactics = playerTransform.GetComponent <PlayerMove>(); tactics.battleMap = battleMap; tactics.posx = pos.x; tactics.posy = pos.y; tactics.stats = pos.stats ?? new StatsContainer(pos); tactics.inventory = pos.inventoryContainer ?? new InventoryContainer(playerClassWheel.GetWpnSkillFromLevel(pos.charData.startClassLevels), pos.inventory); tactics.skills = pos.skills ?? new SkillsContainer(playerClassWheel.GetSkillsFromLevel(pos.charData.startClassLevels, pos.charData.startClass, pos.level)); tactics.squad = pos.joiningSquad; if (addToPrep) { playerData.AddNewPlayer(tactics); PrepCharacter prep = new PrepCharacter(playerData.stats.Count - 1); if (pos.joiningSquad == 2) { prepList2.values.Add(prep); } else { prepList1.values.Add(prep); } } if (active) { tactics.Setup(); } else { playerTransform.gameObject.SetActive(false); } if (cursorHover) { cursorX.value = pos.x; cursorY.value = pos.y; cursorMoveEvent.Invoke(); } return(tactics); }
/// <summary> /// Spawns an enemy character on the map. /// </summary> /// <param name="pos"></param> /// <param name="stats"></param> /// <param name="inventory"></param> /// <param name="skills"></param> public void SpawnEnemyCharacter(SpawnData pos) { Transform enemyTransform = Instantiate(enemyPrefab, battleMap.enemyParent); NPCMove tactics = enemyTransform.GetComponent <NPCMove>(); tactics.battleMap = battleMap; tactics.posx = pos.x; tactics.posy = pos.y; tactics.stats = new StatsContainer(pos); tactics.faction = Faction.ENEMY; tactics.inventory = new InventoryContainer(enemyClassWheel.GetWpnSkillFromLevel(pos.charData.startClassLevels), pos.inventory); tactics.skills = new SkillsContainer(enemyClassWheel.GetSkillsFromLevel(pos.charData.startClassLevels, pos.charData.startClass, pos.level)); tactics.fightQuotes = pos.quotes; tactics.talkQuotes = pos.talks; tactics.aggroType = pos.aggroType; tactics.huntTile = battleMap.GetTile(pos.huntX, pos.huntY); tactics.patrolTiles.Clear(); for (int i = 0; i < pos.patrolPositions.Count; i++) { tactics.patrolTiles.Add(battleMap.GetTile(pos.patrolPositions[i])); } tactics.Setup(); }