public void CreateGem(int row, int c, SphereGem hgem) { if (!sphereAll.Contains(new Vector3(c, 0, row))) { Vector3 vectorgem = vector2position + (new Vector3(c, 0, row)); sphereAll.Add(vectorgem); float radiussphere = Random.Range(databaseTable.unitSpawnMinRadius, databaseTable.unitSpawnMaxRadius); SphereGem sphere = ((GameObject)Instantiate(hgem.gameObject, vectorgem, Quaternion.identity)).GetComponent <SphereGem>(); sphere.transform.localScale = new Vector3( sphere.transform.localScale.x * radiussphere, sphere.transform.localScale.y * radiussphere, sphere.transform.localScale.z * radiussphere ); sphere.RotationNum = Random.Range(1, 4); if (sphere.name == "robot(Clone)") { blue += 1; } if (sphere.name == "robot2(Clone)") { red += 1; } //sphere.RotAll(); GetSpheres.Add(sphere); } else { CreateGem(Random.Range(0, 100), Random.Range(0, 100), spherePrefab[Random.Range(0, spherePrefab.Length)]); } }
public void LoadBasic() { basicManager.ClearSpheres(); basicManager.clearSphereVec(); SphereGem[] spheres2 = new SphereGem[PlayerPrefs.GetInt("SavedCount")]; FindObjectOfType <LevelManager>().query(spheres2); foreach (SphereGem gemsp in spheres2) { CreateGems2(gemsp.row, gemsp.col, basicManager.spheresPref()[gemsp.color], gemsp.RotationNum, gemsp.sradius); } }
public void RemoveSphere(SphereGem sp) { if (sp.name == "robot(Clone)") { blue -= 1; } if (sp.name == "robot2(Clone)") { red -= 1; } GetSpheres.Remove(sp); Destroy(sp.gameObject); }
public void CreateGems2(float row, float c, SphereGem hgem, int rotnum, float rad) { Vector3 vectorgem = vector2position + (new Vector3(c, 0, row)); basicManager.AddSphereVec(vectorgem); SphereGem sphere = ((GameObject)Instantiate(hgem.gameObject, vectorgem, Quaternion.identity)).GetComponent <SphereGem>(); sphere.RotationNum = rotnum; sphere.transform.localScale = new Vector3( rad, rad, rad ); sphere.RotAll(); basicManager.AddSphere(sphere); }
public void query(SphereGem[] spheres) { InstanceLoaded(); for (int i = 0; i < PlayerPrefs.GetInt("SavedCount"); i++) { SphereGem sphereGem1 = new SphereGem(); sphereGem1.color = LoadedConfigs[i].color; sphereGem1.RotationNum = LoadedConfigs[i].RotationNum; sphereGem1.row = LoadedConfigs[i].row; sphereGem1.col = LoadedConfigs[i].c; sphereGem1.sradius = LoadedConfigs[i].sradius; spheres[i] = sphereGem1; } }
public bool isequal(SphereGem hitCandy) { return(hitCandy != null && hitCandy.type == type && hitCandy.type != "ingredient" + 0 && hitCandy.type != "ingredient" + 1); }
public void OnInit(SphereGem hitI) { hitGem = hitI; hitGem.isGem(this); }
public void AddSphere(SphereGem sp) { GetSpheres.Add(sp); }