Exemple #1
0
    public void assignScripts()
    {
        inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
        player    = GameObject.FindGameObjectWithTag("Player").GetComponent <AstronautMovement>();

        if (GameObject.FindGameObjectWithTag("IceGollem") != null)
        {
            iceGolem = GameObject.FindGameObjectWithTag("IceGollem").GetComponent <IceGolemScript>();
        }



        if (GameObject.FindGameObjectWithTag("Gollem") != null)
        {
            lavaGolem = GameObject.FindGameObjectWithTag("Gollem").GetComponent <FollowThePath>();
        }

        if (GameObject.FindGameObjectWithTag("MineralGollem") != null)
        {
            mineralGolem = GameObject.FindGameObjectWithTag("MineralGollem").GetComponent <MineralGolemScript>();
        }

        if (GameObject.FindGameObjectWithTag("FinalBoss") != null)
        {
            finalBoss = GameObject.FindGameObjectWithTag("FinalBoss").GetComponent <FinalBossMovement>();
        }
    }
Exemple #2
0
    public static void Save(AstronautMovement player, IceGolemScript iceGolem, FollowThePath lavaGolem, MineralGolemScript mineralGolem, FinalBossMovement finalBoss, List <GameObject> items)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string path = Application.persistentDataPath + "/player.save";

        FileStream stream = new FileStream(path, FileMode.Create);

        Data data = new Data(player, iceGolem, lavaGolem, mineralGolem, finalBoss, items);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Exemple #3
0
    public Data(AstronautMovement player, IceGolemScript iceGolem, FollowThePath lavaGolem, MineralGolemScript mineralGolem, FinalBossMovement finalBoss, List <GameObject> items)
    {
        health = player.health;
        oxygen = player.oxygen;


        if (items.Count > 0)
        {
            Debug.Log("Entered");
            tags = new int[items.Count];
            for (int i = 0; i < items.Count; i++)
            {
                if (items[i].tag != "Untagged")
                {
                    string tag = items[i].tag;
                    Debug.Log(tag);
                    tags[i] = int.Parse(tag);
                }
            }
        }

        if (iceGolem != null)
        {
            positionIceGolem = new float[3];



            positionIceGolem[0] = iceGolem.transform.position.x;
            positionIceGolem[1] = iceGolem.transform.position.y;
            positionIceGolem[2] = iceGolem.transform.position.z;

            iceGolemHealth = iceGolem.health;
        }
        else
        {
            iceGolemAlive = false;
        }

        if (lavaGolem != null)
        {
            lavaGolemHealth = lavaGolem.health;

            positionLavaGolem = new float[3];

            positionLavaGolem[0] = lavaGolem.transform.position.x;
            positionLavaGolem[1] = lavaGolem.transform.position.y;
            positionLavaGolem[2] = lavaGolem.transform.position.z;
        }
        else
        {
            lavaGolemAlive = false;
        }

        if (mineralGolem != null)
        {
            mineralGolemHealth = mineralGolem.health;

            positionMineralGolem = new float[3];

            positionMineralGolem[0] = mineralGolem.transform.position.x;
            positionMineralGolem[1] = mineralGolem.transform.position.y;
            positionMineralGolem[2] = mineralGolem.transform.position.z;
        }
        else
        {
            mineralGolemAlive = false;
        }

        if (finalBoss != null)
        {
            finalBossHealth = finalBoss.health;

            positionFinalBoss = new float[3];

            positionFinalBoss[0] = finalBoss.transform.position.x;
            positionFinalBoss[1] = finalBoss.transform.position.y;
            positionFinalBoss[2] = finalBoss.transform.position.z;
        }
        else
        {
            finalBossAlive = false;
        }



        positionPlayer = new float[3];



        positionPlayer[0] = player.transform.position.x;
        positionPlayer[1] = player.transform.position.y;
        positionPlayer[2] = player.transform.position.z;
    }
Exemple #4
0
 private void Save(AstronautMovement player, IceGolemScript iceGolem, FollowThePath lavaGolem, MineralGolemScript mineralGolem, FinalBossMovement finalBoss, List <GameObject> items)
 {
     SaveSystem.Save(player, iceGolem, lavaGolem, mineralGolem, finalBoss, items);
     hasSaved = true;
 }