コード例 #1
0
    public void NewGameProcess()
    {
        gameSessionData = new GameSessionData();
        gameSessionData.wipeAbilityCount         = 2;
        gameSessionData.doubleDamageAbilityCount = 2;
        gameSessionData.freezeAbilityCount       = 2;
        gameSessionData.shieldAbilityCount       = 2;
        gameSessionData.planetStatus.Add(1, false);

        /*gameSessionData.planetStatus.Add (2, false);
        *  gameSessionData.planetStatus.Add (3, false);
        *  gameSessionData.planetStatus.Add (4, false);
        *  gameSessionData.planetStatus.Add (5, false);
        *  gameSessionData.planetStatus.Add (6, false);*/

        for (int i = 1; i <= 6; i++)
        {
            LevelSaveData levelSaveData = new LevelSaveData();
            levelSaveData.levelID  = 1;
            levelSaveData.planetID = i;
            gameSessionData.levels.Add(i.ToString() + "_1", levelSaveData);
        }

        SaveGameSessionData();
    }
コード例 #2
0
ファイル: GameStateEndless.cs プロジェクト: COZITIME/Hexscape
    public override void StartGameState()
    {
        Debug.Log("GameStateEndless: Start Game State ");
        currentSessionData = new GameSessionData();
        PopulateLevelsArray();

        InitialiseClickSounds();


        Vector3 mapPosition = MapSpawner.Instance.GetCurrentMapHolder().transform.position;

        mapPosition += new Vector3(0, 10, 0);
        //GameManager.instance.GetPlayerBall().transform.position = mapPosition; // ballPosition;
        GameManager.instance.GetPlayerBall().SetActive(true);


        energyMetreTunnel = GameManager.instance.gameObject.AddComponent <HexTunnelEnergy>();
        energyMetreTunnel.Initialise(8, 30, 7);
        //energyMetreTunnel.edgeValue = energyMetre.GetEnergyMax() / 6;



        editMode = PlayerPrefs.GetInt("Edit Mode") == 1;
        if (editMode == true) // level edit on start... if the ball does not spawn we go into edit mode because of a helpfull bug thingo :)
        {
            Object.Destroy(Object.FindObjectOfType <PlayerController>().gameObject);
        }
        else
        {
            playerController = GameManager.instance.GetPlayerBall().GetComponent <PlayerController>();
        }

        LoadNextLevel();
    }
コード例 #3
0
    private void TryCreateGameSession()
    {
        GameSessionData data = new GameSessionData(GameManager.UserInfo.Username, PublicGameToggle.isOn);

        Network.SendDataToServer("CreateGame", data);
        //hide screen
        MessagingSystem.DispatchMessage(MessageType.OnOpenGamePanel, null);
        Deactivate();
    }
コード例 #4
0
        public static void Save(GameSessionData data)
        {
            EnsureSavesDir();

            var fileName   = DateTime.Now.ToString("yyyy M d hh mm ss") + ".save";
            var pathToFile = Path.Combine(SavesDir, fileName);

            File.WriteAllText(pathToFile, JsonUtility.ToJson(data, true));
        }
コード例 #5
0
    public static GameSessionData LoadGameSessionData()
    {
        string          path = Application.persistentDataPath + "/Resources/currentGameData.gameData";
        GameSessionData loadedInfo = new GameSessionData();
        FileStream      file; BinaryFormatter bf = new BinaryFormatter();

        if (File.Exists(path))
        {
            file       = File.Open(path, FileMode.Open);
            loadedInfo = (GameSessionData)bf.Deserialize(file);
            file.Close();
        }
        return(loadedInfo);
    }
コード例 #6
0
    public static void SaveGameSessionData(GameSessionData data)
    {
        FileStream      file;
        BinaryFormatter bf = new BinaryFormatter();

        CreateDirectoryIfNotExist(Application.persistentDataPath + "/Resources/");
        string path = Application.persistentDataPath + "/Resources/currentGameData.gameData";

        if (File.Exists(path))
        {
            File.Delete(path);
        }
        file = File.Create(path);
        bf.Serialize(file, data);
        file.Close();
    }
コード例 #7
0
 void Awake()
 {
     instance = this;
     StartCoroutine(GameController.ActionAfterFewFramesCoroutine(2, () => {
         if (SaveLoadController.GameSessionDataExist())
         {
             gameSessionData = SaveLoadController.LoadGameSessionData();
         }
         else
         {
             NewGameProcess();
         }
         BattleInterface.instance.RedrawAllInfo();
         //StartCoroutine(GameController.ActionAfterFewFramesCoroutine(15, () => {
         //CheckFullVersionGame();
         //}));
     }));
 }
コード例 #8
0
 public override void PassSessionData(GameSessionData data)
 {
     currentSessionData = data;
 }
コード例 #9
0
ファイル: GameStateBase.cs プロジェクト: COZITIME/Hexscape
 public virtual void PassSessionData(GameSessionData data)
 {
     //throw new System.NotImplementedException();
 }