public PlayerData(PlayerController360 _player) { playerName = _player.PlayerName; randomNumber = _player.jumpForce; position = new float[3]; position[0] = _player.transform.position.x; position[1] = _player.transform.position.y; position[2] = _player.transform.position.z; }
static string path = "C:/Users/3c5f2e60602afde9/Documents/Save/playerData.fun"; //Application.persistentDataPath + " / playerData.fun"; public static void SavePlayer(PlayerController360 _player) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(_player); formatter.Serialize(stream, data); stream.Close(); }
public void StartTrainerBattle(CreatureTeam playerteam, CreatureTeam trainerTeam) { //wierd use of the same name just to make it work in script this.playerteam = playerteam; this.trainerteam = trainerTeam; ////for trainer battle, bug fix to false isTrainerBattle = true; //player = playerteam.GetComponent<PlayerController3D>(); player = playerteam.GetComponent <PlayerController360>(); trainer = trainerteam.GetComponent <TrainerController>(); StartCoroutine(SetUpBattle()); }
//what happens if the target unit fainted void CheckForBattleOver(BattleUnit faintedUnit) { if (faintedUnit.IsPlayerUnit) { var nextCreature = playerteam.GetHealthyCreature(); if (nextCreature != null) { OpenPartyScreen(); } else { BattleOverKO(false); } } else { if (!isTrainerBattle) { BattleOverKO(true); } else { var nextCreature = trainerteam.GetHealthyCreature(); if (nextCreature != null) { //send out next creature //StartCoroutine(SendNextTrainerCreature(nextCreature)); StartCoroutine(AboutToUse(nextCreature)); } else { if (isTrainerBattle) { switch (trainer.name) { case "GrassTrainerAI": PlayerController360.ChangeClearanceLevel("Water"); unlockPlanetScreen.GetComponentInChildren <Text>().text = "You have unlocked the Water Planet!"; break; case "WaterTrainerAI": PlayerController360.ChangeClearanceLevel("Desert"); unlockPlanetScreen.GetComponentInChildren <Text>().text = "You have unlocked the Desert Planet!"; break; case "DesertTrainerAI": PlayerController360.ChangeClearanceLevel("Fire"); unlockPlanetScreen.GetComponentInChildren <Text>().text = "You have unlocked the Fire Planet!"; break; case "FireTrainerAI": PlayerController360.ChangeClearanceLevel("WIN"); unlockPlanetScreen.GetComponentInChildren <Text>().text = "You have beaten the game!"; Debug.Log("YOU WIN!!!!"); break; } unlockPlanetScreen.SetActive(true); } Destroy(trainer.gameObject); BattleOver(true); } } } }