//攻撃されたとき、攻撃側からここにアクセス public void DamagedAnim(int dmg) { HP -= dmg; HPber.value = HP; if (HP <= HPber.maxValue / 4) { HPber.gameObject.transform.FindChild("Fill Area/Fill").GetComponent <Image>().color = new Color(160, 0, 0); } else if (HP <= HPber.maxValue / 2) { HPber.gameObject.transform.FindChild("Fill Area/Fill").GetComponent <Image>().color = Color.yellow; } if (HP <= 0) { iTween.FadeTo(gameObject, iTween.Hash("alpha", 0f, "time", 2f)); //グリッドからはすぐに消す SetGrid(null, ConvertObjectToVector(gameObject)); Destroy(gameObject, 2f); if (tag == "Enemy") { BattleManager.instance.enemies.Remove(gameObject); } else if (tag == "Player") { BattleManager.instance.players.Remove(gameObject); } //Enemyが全滅したら勝利 if (BattleManager.instance.enemies.Count <= 0) { BattleManager.instance.Win(); } //誰か一人でもやられたら敗北 else if (BattleManager.instance.players.Count < 3) { BattleManager.instance.Lose(); } } else { iTween.ShakePosition(gameObject, iTween.Hash("x", 0.1f, "time", 1.5f)); var options = FlashingManager.Hash("minAlpha", 0.3f, "color", Color.red, "count", 4, "time", 1.5f); FlashingManager.Execute(GetComponent <SpriteRenderer>(), options); } }
private void Judge(Sprite sprite, string message) { instance.isGameEnd = true; Image judge = GameObject.Find("Canvas/JudgePanel").GetComponent <Image>(); judge.enabled = true; judge.sprite = sprite; AddMessage(message); FlashingManager.Execute(judge, FlashingManager.Hash("minAlpha", 0.3f, "infinite", true)); instance.mainOtherArrow.StopSelect(); instance.mainPlayerArrow.StopSelect(); instance.subArrow.StopSelect(); instance.commandPanel.SetActive(false); }
public void DamagedAnim <T>(T other) { FlashingManager.Execute(other, FlashingManager.Hash("minAlpha", 0.3f, "color", Color.red, "count", 2)); }
int[] AttackCasePlayer() { int[] selectedColor = null; Vector2 pos = player.ConvertObjectToVector(player.gameObject); if (currentSelected == selectButton[0].gameObject) { if (pos == new Vector2(0, 0)) { selectedColor = new int[] { 0 } } ; else if (pos == new Vector2(0, 2)) { selectedColor = new int[] { 1 } } ; else if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 2 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 3 } } ; else if (pos == new Vector2(2, 0)) { selectedColor = new int[] { 4 } } ; else if (pos == new Vector2(2, 2)) { selectedColor = new int[] { 5 } } ; lineColor = notMovedColor; } else if (currentSelected == selectButton[1].gameObject) { if (pos == new Vector2(0, 0) || pos == new Vector2(0, 2)) { selectedColor = new int[] { 0, 1 } } ; else if (pos == new Vector2(1, 0) || pos == new Vector2(1, 2)) { selectedColor = new int[] { 2, 3 } } ; else if (pos == new Vector2(2, 0) || pos == new Vector2(2, 2)) { selectedColor = new int[] { 4, 5 } } ; lineColor = movedColor; } else if (currentSelected == selectButton[2].gameObject) { if (pos == new Vector2(0, 0) || pos == new Vector2(2, 2)) { selectedColor = new int[] { 6, 7 } } ; else if (pos == new Vector2(0, 2) || pos == new Vector2(2, 0)) { selectedColor = new int[] { 8, 9 } } ; lineColor = movedColor; } return(selectedColor); } int[] AttackCaseBraver() { int[] selectedColor = null; Vector2 pos = braver.ConvertObjectToVector(braver.gameObject); if (currentSelected == selectButton[0].gameObject) { if (pos == new Vector2(0, 0)) { selectedColor = new int[] { 0 } } ; else if (pos == new Vector2(0, 2)) { selectedColor = new int[] { 1 } } ; else if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 2 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 3 } } ; else if (pos == new Vector2(2, 0)) { selectedColor = new int[] { 4 } } ; else if (pos == new Vector2(2, 2)) { selectedColor = new int[] { 5 } } ; lineColor = notMovedColor; } else if (currentSelected == selectButton[1].gameObject) { if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 2, 6 } } ; else if (pos == new Vector2(2, 0)) { selectedColor = new int[] { 4, 16 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 3, 9 } } ; else if (pos == new Vector2(2, 2)) { selectedColor = new int[] { 5, 15 } } ; lineColor = movedColor; } else if (currentSelected == selectButton[2].gameObject) { if (pos == new Vector2(0, 0)) { selectedColor = new int[] { 0, 14 } } ; else if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 2, 8 } } ; else if (pos == new Vector2(0, 2)) { selectedColor = new int[] { 1, 17 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 3, 7 } } ; lineColor = movedColor; } return(selectedColor); } int[] AttackCasePrincess() { int[] selectedColor = null; Vector2 pos = princess.ConvertObjectToVector(princess.gameObject); if (currentSelected == selectButton[0].gameObject) { if (pos == new Vector2(0, 0)) { selectedColor = new int[] { 0 } } ; else if (pos == new Vector2(0, 2)) { selectedColor = new int[] { 1 } } ; else if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 2 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 3 } } ; else if (pos == new Vector2(2, 0)) { selectedColor = new int[] { 4 } } ; else if (pos == new Vector2(2, 2)) { selectedColor = new int[] { 5 } } ; lineColor = notMovedColor; } else if (currentSelected == selectButton[1].gameObject) { if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 14 } } ; else if (pos == new Vector2(2, 0)) { selectedColor = new int[] { 8 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 17 } } ; else if (pos == new Vector2(2, 2)) { selectedColor = new int[] { 7 } } ; lineColor = notMovedColor; } else if (currentSelected == selectButton[2].gameObject) { if (pos == new Vector2(0, 0)) { selectedColor = new int[] { 6 } } ; else if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 16 } } ; else if (pos == new Vector2(0, 2)) { selectedColor = new int[] { 9 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 15 } } ; lineColor = notMovedColor; } return(selectedColor); } int[] MoveCaseALL(GameObject obj) { int[] selectedColor = null; Vector2 pos = player.ConvertObjectToVector(obj); if (currentSelected == selectButton[0].gameObject) { if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 10 } } ; else if (pos == new Vector2(2, 0)) { selectedColor = new int[] { 11 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 12 } } ; else if (pos == new Vector2(2, 2)) { selectedColor = new int[] { 13 } } ; } else if (currentSelected == selectButton[1].gameObject) { if (pos == new Vector2(0, 0)) { selectedColor = new int[] { 10 } } ; else if (pos == new Vector2(1, 0)) { selectedColor = new int[] { 11 } } ; else if (pos == new Vector2(0, 2)) { selectedColor = new int[] { 12 } } ; else if (pos == new Vector2(1, 2)) { selectedColor = new int[] { 13 } } ; } lineColor = movedColor; return(selectedColor); } void BrightLine(int[] array) { OnDisable(); if (array == null) { return; } //指定したモノだけ色を変える for (int i = 0; i < array.Length; i++) { moveLine[array[i]].color = lineColor; moveLine[array[i]].enabled = true; } if (!FindObjectOfType <FlashingManager>()) { for (int i = 0; i < array.Length; i++) { FlashingManager.Execute(moveLine[array[i]], FlashingManager.Hash("minAlpha", 0.3f, "count", 2)); } } } //ここにアクセスすると停止する public new void StopSelect() { isStartSelect = false; GetComponent <Image>().enabled = false; GetComponent <TraceLine>().enabled = false; } }