Ejemplo n.º 1
0
 public static void GetValuesFrom(this GameObject go, sGameObject sgo)
 {
     sgo.toGameObject(go);
 }
Ejemplo n.º 2
0
    public void SaveValues()
    {
        GameManager game = GameManager.instance;
        EnemyManager enemyManager = EnemyManager.instance;
        OnGuiManager onGuiManager = OnGuiManager.instance;
        SmoothMouseLookX mouseX = SmoothMouseLookX.instance;
        SmoothMouseLookY mouseY = SmoothMouseLookY.instance;
        TriggerHandler dragonTriggerHandler = TriggerHandler.instance;

        dragonSlayed = game.statistics.dragonSlayed;

        // save GameObject, Transform, Vector3 and Quaternion by adding .Serializable() extension
        sPlayer = game.player.gameObject.Serializable();
        sTreasure = game.treasure.gameObject.Serializable();
        if (dragonSlayed){
            GameObject dragonRagdoll = GameObject.Find("Dragon Ragdoll(Clone)");
            sDragon = dragonRagdoll.Serializable();
        } else {
            sDragon = game.dragon.gameObject.Serializable();
        }

        // save enemies and misc objects by listing them
        sGameObjects = new List<sGameObject>();
        foreach (GameObject go in GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[]){
            if (go.name.Equals("orc(Clone)") || go.name.Equals("orc ragdoll(Clone)") ||
                go.name.Equals("Lizard(Clone)") || go.name.Equals("Lizard ragdoll(Clone)") ||
                go.name.Equals("WereWolf(Clone)") || go.name.Equals("WereWolf ragdoll(Clone)")){
                sGameObjects.Add(go.Serializable());
            }
        }

        // save current time and date
        dateTime = System.DateTime.Now.ToString("MM/dd/yyyy, HH:mm");

        // save playtime with previous value + time since level load
        playTime = game.statistics.playTime + Time.timeSinceLevelLoad;

        // save time variables relative to Time.timeSinceLevelLoad as load game's time starts from 0
        timeOfLastWave = enemyManager.timeOfLastWave - Time.timeSinceLevelLoad;
        timeOfEnemyCountRising = enemyManager.timeOfEnemyCountRising - Time.timeSinceLevelLoad;
        spawnTimeStart = enemyManager.spawnTimeStart - Time.timeSinceLevelLoad;

        // save game difficulty setting
        difficulty = game.difficulty;

        formatVersion = game.saves.GetFormatVersion();

        // save regular variable here
        timeBetweenEnemyCountAddition = enemyManager.timeBetweenEnemyCountAddition;
        waveIntervalOnDragonFight = enemyManager.waveIntervalOnDragonFight;
        maxDragonFightEnemies = enemyManager.maxDragonFightEnemies;
        dragonFightSpwans = enemyManager.dragonFightSpwans;
        waveInterval = enemyManager.waveInterval;
        maxEnemies = enemyManager.maxEnemies;
        originalWaveInterval = enemyManager.originalWaveInterval;
        originalMaxEnemies = enemyManager.originalMaxEnemies;
        inBattle = enemyManager.inBattle;
        spawnCount = enemyManager.spawnCount;
        nextEnemyType = enemyManager.nextEnemyType;
        dragonHasAggroOnPlayer = dragonTriggerHandler.dragonHasAggroOnPlayer;
        playerKilledTrigger = dragonTriggerHandler.playerKilled;
        mousePositionX = mouseX.GetPosition();
        mousePositionY = mouseY.GetPosition();
        //mouseSensitivity = mouseX.sensitivity;
        //mouseSmoothing = mouseX.smoothing;
        level = game.statistics.level;
        bodycount = game.statistics.bodycount;
        score = game.statistics.score;
        pickupState = game.pickupState;
        bloodAlpha = onGuiManager.bloodSplatter.GetBloodAlpha();
        playerArmor = game.player.GetArmor();
        playerHealth = game.player.GetHealth();
        playerAlive = game.player.GetAliveStatus();
        treasureOnGround = game.treasure.OnGround();
        treasureAmount = game.treasure.GetTreasureAmount();
        wave = game.statistics.wave;
        gun0_rounds = game.weapons.guns[0].currentRounds;
        gun1_rounds = game.weapons.guns[1].currentRounds;
        gun2_rounds = game.weapons.guns[2].currentRounds;
        gun3_rounds = game.weapons.guns[3].currentRounds;
        gun4_rounds = game.weapons.guns[4].currentRounds;
        gun0_clips = game.weapons.guns[0].totalClips;
        gun1_clips = game.weapons.guns[1].totalClips;
        gun2_clips = game.weapons.guns[2].totalClips;
        gun3_clips = game.weapons.guns[3].totalClips;
        gun4_clips = game.weapons.guns[4].totalClips;
        pickedup_gun3 = game.weapons.guns[3].picked_up;
        pickedup_gun4 = game.weapons.guns[4].picked_up;
        pickedup_armor = game.statistics.armorPickedUp;
        grenades = game.weapons.grenadeCount;
        currentGunIndex = game.weapons.currentGunIndex;
        dragonFighting = game.dragon.GetFighting();
        dragonPatroling = game.dragon.GetPatroling();
        dragonWalking = game.dragon.GetWalking();
        dragonLanding = game.dragon.GetLanding();
        dragonHealth = game.dragon.GetHealth();
        dragonMaxHealth = game.dragon.GetMaxHealth();
        dragonBreathFire = game.dragon.breathFire;
        dragonLastBreath = game.dragon.timeOfLastFireBreath;
        dragonFlying = game.dragon.flying;
    }