Exemplo n.º 1
0
 public void spawnNewSpiderFromBait(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript)
 {
     if (spiderSpawnerScript.mySpider == null && spiderSpawnerScript.myBait != null)
     {
         Bait       baitScript           = spiderSpawnerScript.myBait.GetComponent <Bait>();
         int        min                  = baitScript.spiderMin;
         int        max                  = baitScript.spiderMax;
         GameObject selectedSpiderPrefab = spiderPrefabs[UnityEngine.Random.Range(min, max)];
         if ((PlayerPrefs.GetInt("totalSpidersKilled") == 0 && PlayerPrefs.GetInt("uniqueSpiderVisits") >= 24 && PlayerPrefs.GetInt("anansiHasVisited") == 0) ||
             (PlayerPrefs.GetInt("anansiHasVisited") == 1 && UnityEngine.Random.Range(0, 25) == 0))
         {
             PlayerPrefs.SetInt("anansiHasVisited", 1);
             selectedSpiderPrefab = spiderPrefabDictionary["Anansi"];
         }
         if (availableSpiders[selectedSpiderPrefab.name] && specialSpiderConditions(selectedSpiderPrefab.name))
         {
             int newNumberOfVisits = PlayerPrefs.GetInt(selectedSpiderPrefab.name + ".numberOfVisits") + 1;
             PlayerPrefs.SetInt(selectedSpiderPrefab.name + ".numberOfVisits", newNumberOfVisits);
             if (newNumberOfVisits >= 3)
             {
                 maybeKillSpider(selectedSpiderPrefab.name);
             }
             spiderSpawnerScript.SendMessage("cleanUpSpider");
             availableSpiders[selectedSpiderPrefab.name] = false;
             spiderSpawnerScript.spiderPrefab            = selectedSpiderPrefab;
             spiderSpawnerScript.SendMessage("spawnSpider");
         }
     }
 }
Exemplo n.º 2
0
    public void cleanUpSpider(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript)
    {
        string existingSpider = PlayerPrefs.GetString(spiderSpawnerName + ".mySpider", "");

        availableSpiders[existingSpider] = true;
        spiderSpawnerScript.SendMessage("cleanUpSpider");
    }
Exemplo n.º 3
0
    public void spawnBait(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript)
    {
        string existingBait = PlayerPrefs.GetString(spiderSpawnerName + ".myBait", "");

        if (existingBait != "")           //there should only ever *not* be bait if a spider's already chlling
        {
            spiderSpawnerScript.SendMessage("placeBait", existingBait);
//			PlayerPrefs.DeleteKey(spiderSpawners[i].gameObject.name+".myBait"); //was this line necessary?
        }
    }
Exemplo n.º 4
0
    public void spawnSpider(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript)
    {
        string existingSpider = PlayerPrefs.GetString(spiderSpawnerName + ".mySpider", "");

        if (existingSpider != "")
        {
            spiderSpawnerScript.spiderPrefab = spiderPrefabDictionary[existingSpider];
            availableSpiders[existingSpider] = false;
            spiderSpawnerScript.SendMessage("spawnSpider");
        }
        else
        {
            spawnNewSpiderFromBait(spiderSpawnerName, spiderSpawnerScript);
        }
    }
Exemplo n.º 5
0
	public void spawnBait(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript) {
		string existingBait = PlayerPrefs.GetString (spiderSpawnerName+".myBait","");
		if (existingBait != "") { //there should only ever *not* be bait if a spider's already chlling
			spiderSpawnerScript.SendMessage("placeBait", existingBait);
//			PlayerPrefs.DeleteKey(spiderSpawners[i].gameObject.name+".myBait"); //was this line necessary?
		} 
	}
Exemplo n.º 6
0
	public void cleanUpSpider(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript) {
		string existingSpider = PlayerPrefs.GetString(spiderSpawnerName+".mySpider","");
		availableSpiders[existingSpider] = true;
		spiderSpawnerScript.SendMessage("cleanUpSpider");
	}
Exemplo n.º 7
0
	public void spawnNewSpiderFromBait(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript) {
		if (spiderSpawnerScript.mySpider == null && spiderSpawnerScript.myBait != null) {
			Bait baitScript = spiderSpawnerScript.myBait.GetComponent<Bait>();
			int min = baitScript.spiderMin;
			int max = baitScript.spiderMax;
			GameObject selectedSpiderPrefab = spiderPrefabs[UnityEngine.Random.Range(min, max)];
			if ((PlayerPrefs.GetInt("totalSpidersKilled") == 0 && PlayerPrefs.GetInt("uniqueSpiderVisits") >= 24 && PlayerPrefs.GetInt("anansiHasVisited") == 0)
				|| (PlayerPrefs.GetInt("anansiHasVisited") == 1 && UnityEngine.Random.Range(0,25) == 0)) {
					PlayerPrefs.SetInt("anansiHasVisited", 1);
					selectedSpiderPrefab = spiderPrefabDictionary["Anansi"];
			}
			if (availableSpiders[selectedSpiderPrefab.name] && specialSpiderConditions(selectedSpiderPrefab.name)){
				int newNumberOfVisits = PlayerPrefs.GetInt(selectedSpiderPrefab.name+".numberOfVisits") + 1;
				PlayerPrefs.SetInt (selectedSpiderPrefab.name+".numberOfVisits", newNumberOfVisits);
				if (newNumberOfVisits >= 3) {
					maybeKillSpider(selectedSpiderPrefab.name);
				}
				spiderSpawnerScript.SendMessage("cleanUpSpider");
				availableSpiders[selectedSpiderPrefab.name] = false;
				spiderSpawnerScript.spiderPrefab = selectedSpiderPrefab;
				spiderSpawnerScript.SendMessage("spawnSpider");
			}
		} 
	}
Exemplo n.º 8
0
	public void spawnSpider(string spiderSpawnerName, SpiderSpawner spiderSpawnerScript) {
		string existingSpider = PlayerPrefs.GetString (spiderSpawnerName+".mySpider","");
		if (existingSpider != "") {
			spiderSpawnerScript.spiderPrefab = spiderPrefabDictionary[existingSpider];
			availableSpiders[existingSpider] = false;
			spiderSpawnerScript.SendMessage("spawnSpider");
		} else {
			spawnNewSpiderFromBait(spiderSpawnerName, spiderSpawnerScript);
		}
	}