//儲存偵測結果 //[param] cdn = 座標編號 , type = 圖格類型 public void AddResult(Vector2 cdn, ElementImageType type) { SensorInfo _info = new SensorInfo(); _info.coordinate = cdn; _info.elementType = type; SpinResultList.Add(_info); }
private Animator anim; //動畫器組件 //--------------------------------------------------------------------------------------------------------------------------------------------- //設定圖片 public void SetType(ElementImageType type) { if (img == null) { img = this.GetComponent <Image>(); } elementType = type; //設定圖格類型 Sprite _sprite = ScrollManager.Instance.Dict_elementAttribute[type].blockSprite; img.sprite = _sprite; //套用圖片 }
//從列表中迭代抽取元素, 打亂List排序 private void RandomExtract(List <ElementImageType> extractList, ref List <ElementImageType> collectList) { if (extractList.Count == 0) { return; //當抽取列表為空時結束程序 } int _dice = Random.Range(0, extractList.Count); //從List長度取一隨機數 ElementImageType _type = extractList[_dice]; //抽取元素 collectList.Add(_type); //匯集至目標列表 extractList.RemoveAt(_dice); //消除抽取位置 RandomExtract(extractList, ref collectList); //迭代呼叫 }
public int amount; //數量 //建構子 public Roulette(ElementImageType t, int a) { type = t; amount = a; }