public void AddClover(Clover clover) { lock (cloverList) { cloverList.Add(clover); } }
// Update is called once per frame void Update() { currentStablePosition = camTrans.position; accumulativeDist = CalcSqrDistance(); if (accumulativeDist > 0.36f) { if (cloverCount < maxCloverCount) { clover = new Clover(cloverTemplate, currentStablePosition + height, cloverParent); CloverManager.AddClover(clover); } else { int index = cloverCount - maxCloverCount; CloverManager.MoveClover(index, currentStablePosition + height); } cloverCount += 1; lastStablePosition = currentStablePosition; } }
// Token: 0x06000273 RID: 627 RVA: 0x00008D90 File Offset: 0x00007190 public void checkCloverCreate() { this.cloverList = SuperGameMaster.GetCloverList(); bool flag = false; if (this.cloverList.Count == 0) { flag = true; Debug.Log("[CloverFarm] クローバーの初期化フラグが立ちました。四葉を生成します"); } if (this.cloverList.Count < this.cloverMax) { Debug.Log(string.Concat(new object[] { "[CloverFarm] クローバーの数を調整します:", this.cloverList.Count, " > ", this.cloverMax })); } while (this.cloverList.Count < this.cloverMax) { CloverDataFormat cloverDataFormat = new CloverDataFormat(); cloverDataFormat.lastHarvest = new DateTime(1970, 1, 1); cloverDataFormat.timeSpanSec = -this.cloverList.Count - 1; cloverDataFormat.newFlag = true; this.cloverList.Add(cloverDataFormat); } if (this.cloverList.Count > this.cloverMax) { Debug.Log(string.Concat(new object[] { "[CloverFarm] クローバーの数を調整します:", this.cloverList.Count, " > ", this.cloverMax })); this.cloverList.RemoveRange(this.cloverMax - 1, this.cloverList.Count - this.cloverMax); } this.cloversObj = new List <GameObject>(); for (int i = 0; i < this.cloverList.Count; i++) { if (!this.cloverList[i].newFlag && this.cloverList[i].timeSpanSec <= 0) { this.cloversObj.Add(this.LoadCloverObject(i, this.cloverList[i])); } } int num = 0; for (int j = 0; j < this.cloverList.Count; j++) { if (this.cloverList[j].newFlag) { if (!flag) { this.cloversObj.Add(this.NewCloverObject(j, this.cloverList[j], this.cloversObj)); } else { this.cloversObj.Add(this.NewCloverObject(j, this.cloverList[j], this.cloversObj, true)); flag = false; } this.cloverList[j].x = this.cloversObj[this.cloversObj.Count - 1].transform.localPosition.x; this.cloverList[j].y = this.cloversObj[this.cloversObj.Count - 1].transform.localPosition.y; Clover component = this.cloversObj[this.cloversObj.Count - 1].GetComponent <Clover>(); this.cloverList[j].element = component.element; this.cloverList[j].spriteNum = component.spriteNum; this.cloverList[j].point = component.point; this.cloverList[j].newFlag = false; num++; } } foreach (GameObject gameObject in this.cloversObj) { int num2 = this.cloverOrderInLayer; foreach (GameObject gameObject2 in this.cloversObj) { if (gameObject.transform.position.y < gameObject2.transform.position.y) { num2++; } } gameObject.GetComponent <SpriteRenderer>().sortingOrder = num2; } Debug.Log(string.Concat(new object[] { "[CloverFarm] クローバー生成完了:", this.cloversObj.Count, "\u3000/ (新規:", num, ")" })); }
public void MoveClover(int index, Vector3 Position) { Clover clover = cloverList[index]; clover.Move(Position); }
// Get data from Azure public async Task GetData() { // Get table from Azure Server var table = AzureMobileServiceClient.Client.GetTable <Clover>(); bool validID = false; // Variable for check the ID is valid // Load data : try several times to load data for (int i = 0; i < numberOfAttemptsToLoadData; i++) { // if not new player if (playerID != string.Empty) { try { //Debug.Log("playerID : " + playerID); Debug.Log("Load player data from Azure..."); myClover = await table.LookupAsync(playerID); Debug.Log("successfully load data from Azure"); validID = true; break; } catch (Exception) { Debug.LogError("lookup error, invalid playerID " + playerID); } } // if new player if (!validID) { try { //Debug.Log("playerID : " + playerID); Debug.Log("New player! make new instance and insert data to Azure..."); if (playerID == string.Empty) { playerID = Guid.NewGuid().ToString("N"); // make new playerID Debug.Log("making new player ID " + playerID); } myClover = new Clover { ID = playerID }; await table.InsertAsync(myClover); break; } catch (Exception) { Debug.LogError("Insert error."); } } // if try n times if (i == numberOfAttemptsToLoadData - 1) { Debug.LogError("Connection failed. Check logs, try again later."); } else { await Task.Delay(500); } } }