int yokomax; //横の長さ #endregion Fields #region Constructors //インスタンス(動くバブーとフィールド) public babooactive(baboo b,trap[,] f) { this.baboo = b; this.field = f; yokomax = field.Length / field.GetLength(0); tatemax = field.GetLength(0); distcalcstart(4, 8); goalpointset(4, 8); }
void activateSelectedTraps() { for (int i = currIndex; i < currIndex + numOfTrapTrrigerAtATime; i++) { trap t = traps[i % traps.Length].GetComponent <trap>(); if (!t.TrapTrigger) { t.TrapTrigger = true; } } }
//攻撃(パンチだけなんで後で増やす public Boolean attack(trap t) { if (t.type == 12) { MessageBox.Show("もぐもぐ"); destructpointset(); motimono.trappointremove(destructpoint.x, destructpoint.y); motimono.tfield[destructpoint.x, destructpoint.y] = null; destruction = true; if (goalpoint.x == destructpoint.x && goalpoint.y == destructpoint.y) { MessageBox.Show(goalpoint.x.ToString() + goalpoint.y.ToString()); goalpoint = pointlist[0]; MessageBox.Show(goalpoint.x.ToString() + goalpoint.y.ToString()); distcalcstart(goalpoint.x, goalpoint.y); pointlist.RemoveAt(0); } else { MessageBox.Show(goalpoint.x.ToString() + goalpoint.y.ToString()); pointlist.RemoveAll(p => p.x == destructpoint.x && p.y == destructpoint.y); } return true; } MessageBox.Show("バブーパンチ!"); if (t.happen == 3) { if ((t.type == 7 || t.type == 8) && t.grade == 1) { actioednfrag = true; } else if(Math.Abs(t.direction-direction)==2) { actioednfrag = true; } } return false; }
//トラップの効果 public void effect(trap t) { //起動回数が10以上はもう起動しない(これ扇風機だけだなあとで変えよう if (happeningcount[now.x, now.y] < 10) { happeningcount[now.x, now.y]++; switch (t.type) { case 3://扇風機 if (t.grade < 2)//2マスの場合 { senpudirection = t.direction;//飛ばされる方向決定 sennpufrag = true;//フラグ立てる senpucount = 2;//カウント設定 } else if (t.grade < 4)//3マス(処理は基本同じ { senpudirection = t.direction; sennpufrag = true; senpucount = 3; } senpumove();//とりあえず一回起動(これしないとかかりっぱになっちゃう break; case 4://ジャンプ台 happen[now.x, now.y] = true;//起動したフラグ立てる now = motimono.tpointd[now.x, now.y].tplist[0]; break; case 5://ぐるぐる happen[now.x, now.y] = true;//起動したフラグ立て if (t.grade == 0 || t.grade == 3)//R { fakedirection = direction; direction = (direction + 1) % 4; } else if (t.grade == 1 || t.grade == 4)//L { fakedirection = direction; direction = (direction - 1) % 4; } else if (t.grade == 2)//U { fakedirection = direction; direction = (direction - 1) % 4; } break; case 6://冷水 case 7://パンチ case 8://ビリビリ happen[now.x, now.y] = true;//起動フラグ baboo.stamina -= 10;//スタミナ減少(これはここでまた変更しよう fragreset();//フラグリセット(しないと永遠にかかる break; case 9://風船サービス happen[now.x, now.y] = true;//起動フラグ baboo.heavy -= 50; break; case 10://米俵サービス happen[now.x, now.y] = true; baboo.heavy += 50; break; case 11://おめでとう happen[now.x, now.y] = true; for (int i = 0; i < baboo.hate.Length; i++) baboo.hate[i] -= 10; break; case 12://エサ break; case 15://とりもち if (toricount == 0 && torifrag == false)//引っかかった瞬間 { //カウント設定 if (t.grade == 0) { toricount = 5; } else if (t.grade == 0) { toricount = 7; } } else if (toricount != 0 || torifrag == false)//引っかかってる間 { toricount--; if (toricount == 0)//カウント0になったらフラグを折る torifrag = true; } break; } } }