public GameObject etoObject; //Prefabの設定 public void SetUpEtoObject(int etoTypeNum) { //干支の種類を選択 this.etoType = (EtoType)etoTypeNum; etoObject = Resources.Load <GameObject>("EtoObject/" + etoTypeNum); if (this.etoType == EtoType.猫) { isMyInfo = true; } }
/// <summary> /// 干支の初期設定 /// </summary> public void SetUpEto(EtoType etoType, Sprite sprite) { // 干支の種類を設定 this.etoType = etoType; // 干支の名前を、設定した干支の種類の名前に変更 name = this.etoType.ToString();; // 引数で届いた干支のイメージに合わせてメージを変更 ChangeEtoImage(sprite); }
public void SetUpEtoInfo(EtoType etoType, int rank, int score) { this.etoType = etoType; this.rank = rank; this.score = score; if (this.etoType != EtoType.猫) { // 干支の画像の設定(画像を Resources フォルダより読み込む。別の方法でも可) etoImage.sprite = Resources.Load <Sprite>("EtoIcon/" + (int)etoType); } else { // 干支の画像の設定(画像を Resources フォルダより読み込む。別の方法でも可) etoImage.sprite = Resources.Load <Sprite>("EtoIcon/" + ((int)etoType + 1)); } DisplayPoint(); }
/// <summary> /// 干支情報の設定 /// </summary> /// <param name="etoTypeNum"></param> /// <param name="point"></param> public void SetUpEtoInfo(int etoTypeNum, int point) { //干支の種類を設定 this.etoType = (EtoType)etoTypeNum; //ポイントの設定 this.point = point; //干支の画像の設定(画像をResourceフォルダより読み込む。別の方法でも可) etoImage.sprite = Resources.Load <Sprite>("EtoIcon/" + etoTypeNum); //干支の種類が猫の場合 if (this.etoType == EtoType.猫) { this.point = 0; isMyInfo = true; } //ポイントの表示 DisplayPoint(); }
//コンストラクタ(インスタンス(new)時に用意している因数への値の代入を強制するメソッド) public EtoData(EtoType etoType, Sprite sprite) { this.etoType = etoType; this.sprite = sprite; }