Exemplo n.º 1
0
    public static void Save(PrincessInfo cham)
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(Application.persistentDataPath + "/Princess.pd", FileMode.OpenOrCreate);

        bf.Serialize(file, cham);
        file.Close();
    }
Exemplo n.º 2
0
 public static PrincessInfo Load()
 {
     if (File.Exists(Application.persistentDataPath + "/Princess.pd"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/Princess.pd", FileMode.Open);
         PrincessInfo    cham = (PrincessInfo)bf.Deserialize(file);
         file.Close();
         return(cham);
     }
     else
     {
         return(new PrincessInfo());
     }
 }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     DataPrincess.Delete();
     _info          = DataPrincess.Load();
     GoldValue.text = _info.gold.ToString();
     _bombs [0].CoolBtn.gameObject.SetActive(true);
     _bombs [0].DmgBtn.gameObject.SetActive(true);
     _caldero.DmgBtn.gameObject.SetActive(true);
     _caldero.CoolBtn.gameObject.SetActive(true);
     HealthBtn.gameObject.SetActive(true);
     Check();
     SetNewPrice(0);
     SetNewPrice(1);
     SetNewPrice(2);
     SetNewPrice(3);
     SetNewPrice(4);
     SetNewPrice(5);
 }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        _info      = DataPrincess.Load();
        gameLevels = DataPrincess.LoadGameLevels();
        DataSender _sender = GameObject.FindObjectOfType <DataSender>();

        if (_sender != null)
        {
            currentLevel = gameLevels.FindLevel(_sender.level);
            Debug.Log("Loading Level: " + _sender.level.ToString());
        }
        else
        {
            currentLevel = gameLevels.FindLevel(1);
        }

        wavesText.text = waveNumber + "/" + currentLevel.numberOfWaves;

        SpawnLevel(currentLevel);
    }
Exemplo n.º 5
0
 void Start()
 {
     pi = DataPrincess.Load();
     for (int i = 0; i < _btnLevels.Length; i++)
     {
         if (i <= pi.unlockedLevels - 1)
         {
             _btnLevels [i].interactable = true;
         }
         else
         {
             _btnLevels [i].interactable = false;
         }
     }
     if (pi.fireShot)
     {
         _ammoImages [1].interactable = true;
     }
     else
     {
         _ammoImages [1].interactable = false;
     }
     if (pi.iceShot)
     {
         _ammoImages [2].interactable = true;
     }
     else
     {
         _ammoImages [2].interactable = false;
     }
     if (pi.bombShot)
     {
         _ammoImages [3].interactable = true;
     }
     else
     {
         _ammoImages [3].interactable = false;
     }
     _ammoImages[0].GetComponent <Image>().color = Color.yellow;
     _ammoSelect.SetActive(false);
 }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        _info      = DataPrincess.Load();
        isPressing = false;
        guides     = new GameObject[20];
        for (int i = 0; i < 20; i++)
        {
            guides [i] = Instantiate(marker, ShootPoint.position, Quaternion.identity) as GameObject;
            guides [i].transform.SetParent(ShootPoint);
        }
        DataSender _sender = GameObject.FindObjectOfType <DataSender>();

        if (_sender != null)
        {
            bullet        = _bullets [_sender._bulletType];
            _selectedType = _sender._bulletType;
        }
        else
        {
            bullet = _bullets [0];
        }


        GamePropertiesScript gps = new GamePropertiesScript();          //Assigning properties based on GameProperties script

        g           = gps.gravity;
        minTime     = gps.bulletMinTime;
        maxTime     = gps.bulletMaxTime;
        minDistance = gps.bulletMinDistance;
        maxDistance = gps.bulletMaxDistance;
        MaxCooldown = gps.currentBulletCooldown;
        if (_info.ally1)
        {
            _allies [0].gameObject.SetActive(true);
        }
        else
        {
            //_allies [0].gameObject.SetActive (false);
        }

        if (_info.ally2)
        {
            _allies [1].gameObject.SetActive(true);
        }
        else
        {
            //_allies [1].gameObject.SetActive (false);
        }

        if (_info.ally3)
        {
            _allies [2].gameObject.SetActive(true);
        }
        else
        {
            //_allies [2].gameObject.SetActive (false);
        }
        switch (_selectedType)
        {
        case 0:
            MaxCooldown -= _info.NormalBulletCooldown * 0.1f;
            break;

        case 1:
            MaxCooldown -= _info.FireBulletCooldown * 0.1f;
            break;

        case 2:
            MaxCooldown -= _info.IceBulletCooldown * 0.1f;
            break;

        case 3:
            MaxCooldown -= _info.BombBulletCooldown * 0.1f;
            break;
        }
        maxHealth = gps.currentPlayerMaxHP + (_info.PlayerHP * 10) - 10;
        _health   = maxHealth;
        x1        = -gps.bulletMinDistance;
        target.gameObject.SetActive(false);
    }