// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.I) && ItemList != null) { bool f = false; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (Floor.Map[i + ItemX, j + ItemZ] == 11 || Floor.Map[i + ItemX, j + ItemZ] == 12) { f = true; } } } if (f) { Vector2 a = mp.Modify(ItemX, ItemZ); if (!(a.x == 0 && a.y == 1)) { f = false; } } if (f) { for (int i = 0; i < ItemList.Count; i++) { cds.GetCard(ItemList[i][0], ItemList[i][1], ItemList[i][2]); //ItemList.Remove(item); Debug.Log("カードを手に入れた"); Debug.Log(ItemList[i][0]); Debug.Log(ItemList[i][1]); Debug.Log(ItemList[i][2]); } Debug.Log("以上"); ItemList = null; Floor.Map[ItemX, ItemZ] -= 30; Destroy(gameObject); } } }
public void Activate() { Vector2 a; ModifyPosition mp = new ModifyPosition(); for (int i = 0; i < fs.enemies.Count; i++) { a = mp.Modify(enemies[i].x, enemies[i].z); Debug.Log("........"); Debug.Log((int)a.x); Debug.Log((int)a.y); Debug.Log("........"); if (type == 1) { if (a.x == 0 && a.y == 1) { enemies[i].nowHP -= (15 * level); //1マス前方攻撃 } } else if (type == 2) { if (-1 <= a.x && a.x <= 1 && a.y == 1) { enemies[i].nowHP -= (20 * level); //1マス前方,左右斜め1マス前攻撃 } } else if (type == 3) { if (-1 <= a.x && a.x <= 1 && -1 <= a.y && a.y <= 1) { enemies[i].nowHP -= (25 * level); //1マス周囲攻撃 } } else if (type == 4) { Vector2 b = mp.WallVertical(pl.dire); b = mp.Modify((int)b.x, (int)b.y); if (a.x == 0 && a.y > 0 && a.y < b.y) { Vector2 c; bool f = true; for (int j = 0; j < fs.enemies.Count; j++) { c = mp.Modify(enemies[j].x, enemies[j].z); if (c.x == 0 && c.y < a.y) { f = false; break; } } if (f) { enemies[i].nowHP -= (30 * level); //前方1列攻撃 } } } else if (type == 5) { if (Floor.Map[pl.posX, pl.posZ] == 11) { Vector2 b = mp.WallVertical(0); Vector2 c = mp.WallVertical(2); Vector2 d = mp.WallVertical(4); Vector2 e = mp.WallVertical(6); if (e.x < enemies[i].x && enemies[i].x < c.x && d.y < enemies[i].z && enemies[i].z < b.y) { enemies[i].nowHP -= (40 * level); //部屋全体攻撃 } } else if (Floor.Map[pl.posX, pl.posZ] == 12) { if (a.x == 0 && a.y == 1) { enemies[i].nowHP -= (5 * level); } } } else if (type == 6) { int healQuantity = 20 * level; if ((Player.maxHP - Player.nowHP) > healQuantity) { Player.nowHP += healQuantity; } else { Player.nowHP = Player.maxHP; } healQuantity = 0; } Debug.Log("敵のHP↓"); Debug.Log(enemies[i].nowHP); } }