public UseSkill ( GameObject caller, GameObject target = null, System optionalParameters = null ) : void | ||
caller | GameObject | |
target | GameObject | |
optionalParameters | System | |
return | void |
//Use a skill. public bool UseSkill(Skill s, AttackData data) { //If the skill is ready and not passive. if (s.IsReady() && !s.isPassive) { //If this is auto or our selected target is vald, use the skill. If we're provoked, ignore validation. if (auto || s.IsValidTarget(selectedUnit, data) || s.isTriggered || data.actor.myStatusEffects.Find(n => n.provoke) != null || EnemyArena.myParty.GetAllLiving().Contains(data.actor)) { //If we are provoked, the applier exists and is alive, select that guy. SetSkillTarget(data); //Use the skill. if (data.actor.myStatusEffects.Find(n => n.preventAction) == null) { s.UseSkill(data); } if (!s.isTriggered) { EndTurn(); } return(true); } else { selectedUnit = null; } } return(false); }
public void TriggerMonsterAction(int skillNumber) { statusEffectManager.ActivateStatusEffects(); if (skillNumber > skillList.Length - 1) { Debug.Log("Invalid skill"); } else { // Shake! Vector2 newPosition = transform.position; newPosition.x += attackShakeAmount; transform.position = newPosition; attackShakeTimer.Go(attackShakeDelay); Skill triggeredSkill = skillList[skillNumber].GetComponent <Skill>(); GameObject target = gameInfo.GetSelectedHero(); if (tauntTarget != 0) { target = gameInfo.characters[tauntTarget]; } lastHit = target; triggeredSkill.UseSkill(gameObject, target); turnManager.MonsterTookTurn(); } }
void Update() { Camera.main.transform.position -= new Vector3(Time.deltaTime * 1f, 0, 0); if (Input.GetKeyDown(KeyCode.N)) { skill01.GetSkill(); } if (Input.GetKeyDown(KeyCode.B)) { skill01.UseSkill(); } if (Input.GetKeyDown(KeyCode.V)) { skill02.GetSkill(); } if (Input.GetKeyDown(KeyCode.K)) { zimuUI.Show("瓶装水"); } /*if (Input.GetKeyDown(KeyCode.O)) * { * getOrLostItem.GetShow("瓶装水",5f); * } * if (Input.GetKeyDown(KeyCode.P)) * { * getOrLostItem.LostShow("罐头"); * }*/ if (Input.GetKeyDown(KeyCode.U)) { bubbleHintUI.ShowAndHide("罐头"); } if (Input.GetKeyDown(KeyCode.L)) { GameObject.Find("BackpackUI/Canvas/Note").transform.GetComponent <NoteUI>().Show("罐头", 2f); } if (Input.GetKeyDown(KeyCode.M)) { Debug.Log("Input M"); Debug.Log(Time.timeScale); GameObject.Find("n格漫画UI").transform.GetComponent <CartoonUI>().Show(5); } if (Input.GetKeyDown(KeyCode.R)) { GameObject.Find("BackpackUI").GetComponent <BackpackUI>().AddItem("炸弹"); } if (Input.GetKeyDown(KeyCode.T)) { GameObject.Find("BackpackUI").GetComponent <BackpackUI>().RemoveItem("炸弹"); } if (Input.GetKeyUp(KeyCode.Q)) { Debug.Log("Input Q"); TransitionUI.FadeOut(); } }
IEnumerator UseSkill(Transform tp_button, Skill tp_skill) { tp_button.GetComponent <Button> ().interactable = false; tp_button.GetComponent <ButtonClass>().ChangeColor(); if (!GameManager.k_Manager.SkillWaiting) { GameManager.k_Manager.SkillWaiting = true; } else { StopCoroutine(GameManager.k_Manager.OldSkillUsed); GameObject[] tp_buttons = GameObject.FindGameObjectsWithTag("SkillButton"); List <GameObject> tp_list = new List <GameObject> (tp_buttons); tp_list.Remove(tp_button.gameObject); tp_buttons = tp_list.ToArray(); for (int i = 0; i < tp_buttons.Length; i++) { SetButtonsInteractable(tp_buttons [i], i); } } tp_button.GetComponent <ButtonClass>().Clicked = true; if (tp_skill.TargetMode == 0) { foreach (Transform trans in tp_button.GetComponent <ButtonClass>().tp_list.ToArray()) { if (trans.FindChild("Character(Clone)") != null) { trans.FindChild("CharacterSpawn").GetComponent <CharacterTrigger> ().clickable = true; } } } if (tp_skill.TargetMode == 2) { foreach (Transform trans in tp_button.GetComponent <ButtonClass>().tp_list.ToArray()) { trans.FindChild("CharacterSpawn").GetComponent <CharacterTrigger> ().clickable = true; } } if (k_Character.isEnemy) { yield return(new WaitForSeconds(1.0f)); } yield return(new WaitUntil(() => GameManager.k_Manager.TargetChosen)); tp_button.GetComponent <ButtonClass> ().Clicked = false; tp_button.GetComponent <ButtonClass>().ChangeColorBack(); tp_button.GetComponent <Button> ().interactable = true; tp_skill.UseSkill(true, 0, null); // GameManager.k_Manager.CheckDeadCharacters (); GameManager.k_Manager.Target = null; GameManager.k_Manager.WantToEndTurn(); }
void PlayerAction(int i) { Skill currentSkill = playerCritter.moveSet[i]; if (currentSkill as SupportSkill) { if (currentSkill.suportSkillUsed < 3) { playerCritter.moveSet[i].UseSkill(enemyCritter); StatusChange(playerCritter, currentSkill); } if (currentSkill.suportSkillUsed == 3 && i == 1) { Notify(currentSkill, i, NotificationType.UpdateHUD); } else if (currentSkill.suportSkillUsed == 3 && i == 2) { Notify(currentSkill, i, NotificationType.UpdateHUD); } } else { currentSkill.UseSkill(enemyCritter); StatusChange(playerCritter, currentSkill); } if (enemyCritter.isDefeated) { Critter oldCritter = enemyCritter; enemy.collection.Remove(enemyCritter.gameObject); player.collection.Add(enemyCritter.gameObject); enemyCritter.transform.position = player.collectionPos.position; enemyCritter.transform.parent = player.collectionPos; if (enemyCritterStack.Count > 0) { NextEnemyCritter(); Notify(oldCritter, enemyCritter, NotificationType.CritterDeath); Notify(this, NotificationType.UpdateHUD); StartCoroutine(EnemyTurn()); } else { BattleWon(); } } else { StartCoroutine(EnemyTurn()); } if (state != BattleState.Won) { CritterStatsChange(); } }
// Dispara las abilidades de la clase public void SkillFire() { if (Input.GetKeyDown(KeyCode.Q)) { skillQ.UseSkill(); } if (Input.GetKeyDown(KeyCode.E)) { skillE.UseSkill(); } }
IEnumerator AutoUseSkill(Skill skill, GameObject player) { GameObject[] goals; Transform sets; if (player.GetComponent <PlayerComponent>().camp == Camp.enemy) { sets = GameObject.Find("Sets/Teammates").transform; } else { sets = GameObject.Find("sets/Enemys").transform; } int num = skill.GetGoalsNum(); goals = new GameObject[num]; bool[] flags = new bool[num]; for (int i = 0; i < num; i++) { flags[i] = false; } for (int i = 0; i < num; i++) { int n = Random.Range(0, num); while (flags[n]) { n = (n + 1) % num; } goals[i] = sets.gameObject.GetComponentsInChildren <PlayerComponent>()[n].gameObject; } skill.SetGoals(goals); skill.SetFlag(false); skill.BeforeUseSkill(); yield return(new WaitUntil(skill.GetFlag)); skill.SetFlag(false); skill.UseSkill(); yield return(new WaitUntil(skill.GetFlag)); skill.SetFlag(false); skill.AfterUseSkill(); yield return(new WaitUntil(skill.GetFlag)); if (bm.GetNextPlayer().GetComponent <PlayerComponent>().camp == Camp.teammate) { canvas.transform.Find("OperationWindow").gameObject.SetActive(true); } bm.NextTurn(); }
public void OnEndDrag(PointerEventData eventData) { if (DetectSpawnArea() && cardData.mana <= Player.Instance.getNowMp()) { skill.UseSkill(); Player.Instance.UseMana(cardData.mana); CardManager.Instance.DeleteCard(this); } else { this.transform.position = originPrs.pos; } isDraging = false; }
void EnemyAction() { int i = Random.Range(0, 3); Skill currentSkill = enemyCritter.moveSet[i]; if (currentSkill as SupportSkill) { if (currentSkill.suportSkillUsed < 3) { enemyCritter.moveSet[i].UseSkill(playerCritter); StatusChange(enemyCritter, currentSkill); } else { EnemyAction(); } } else { currentSkill.UseSkill(playerCritter); StatusChange(enemyCritter, currentSkill); } if (playerCritter.isDefeated) { Critter oldCritter = playerCritter; player.collection.Remove(playerCritter.gameObject); enemy.collection.Add(playerCritter.gameObject); playerCritter.transform.position = enemy.collectionPos.position; playerCritter.transform.parent = enemy.collectionPos; if (playerCritterStack.Count > 0) { NextPlayerCritter(); Notify(oldCritter, playerCritter, NotificationType.CritterDeath); Notify(this, NotificationType.UpdateHUD); Invoke("PlayerTurn", 2f); } else { BattleLost(); } } else { Invoke("PlayerTurn", 2f); } CritterStatsChange(); }
public void ActivateSkill() { if (!activateSkill && skills.Count > 0) { Skill activeSkill = skills[0]; skills.RemoveAt(0); skill = activeSkill; skill.UseSkill(); activateSkill = true; skillDuration = skill.durability; skillBar.maxValue = skillDuration; skillBar.value = skillDuration; skillActiveImage.enabled = true; skillActiveImage.sprite = skillImage[0].sprite; skillActiveImage.color = skillImage[0].color; UpdateImage(); } }
IEnumerator UseSkill(Skill skill) { skill.SetFlag(false); skill.ChooseGoal(); yield return(new WaitUntil(skill.GetFlag)); skill.SetFlag(false); skill.BeforeUseSkill(); yield return(new WaitUntil(skill.GetFlag)); skill.SetFlag(false); skill.UseSkill(); yield return(new WaitUntil(skill.GetFlag)); skill.SetFlag(false); skill.AfterUseSkill(); yield return(new WaitUntil(skill.GetFlag)); bm.NextTurn(); }
private void ExecuteHeroAction() { // Shake! Vector2 newPosition = transform.position; newPosition.y += attackShakeAmount; transform.position = newPosition; attackShakeTimer.Go(attackShakeDelay); if (triggeredSkillNumber > skillList.Length - 1) { Debug.Log("Invalid skill"); } else { Skill triggeredSkill = skillList[triggeredSkillNumber].GetComponent <Skill>(); triggeredSkill.UseSkill(gameObject, gameInfo.GetTheMonster()); turnManager.HeroTookTurn(myInfo.characterNumber); } }
// Update is called once per frame void Update() { //If you press the button associated with the hotkey slot if (Input.GetKeyDown(keyPress)) { int id = hotkey.id; //Get the id of the item or skill the player is going to use if (id != -1) //If there's actually something in the hotkey slot { if (hotkey.hotkeyType.Equals(Hotkey.HotkeyType.ITEM)) //If it's an item { UsableItem item = (UsableItem)itemDB.GetItemByID(id); //Get the actual item item.Action(); //Perform the action associated with the item } else //If it's a skill { Skill skill = (Skill)skillDB.GetSkillByID(id); //Get the actual skill skill.UseSkill(); //Use the skill } } } }
// Use the current skill if unused and ready. Turn off current skill otherwise. public void UseCurrentSkill(InputAction.CallbackContext context) { if (currentSkill.isActive) { currentSkill.DeactivateSkill(); } else { if (player.data.remainingStamana >= currentSkill.usageCost) { if (currentSkill.UseSkill()) { player.data.remainingStamana -= currentSkill.usageCost; } } else { Debug.Log("Not enough stamana!"); } } }
public void AddSkill(int skillNumber, Skill skill) { switch (skillNumber) { case 1: skill1 = skill; skillPanelControll.AddNewSkillToPanel(skill); break; case 2: skill2 = skill; skillPanelControll.AddNewSkillToPanel(skill); break; case 3: skill3 = skill; skillPanelControll.AddNewSkillToPanel(skill); break; case 4: skill4 = skill; skillPanelControll.AddNewSkillToPanel(skill); break; case 5: skill5 = skill; skillPanelControll.AddNewSkillToPanel(skill); break; } if (skill.GetIsSkillPassive() == true) { skill.UseSkill(); } }
public virtual void SelectSkill() { List <Skill> readyList = new List <Skill>(); for (int i = 0; i < skillList.Count; i++) { skillList[i].CheckSkill(); if (!skillList[i].isAlwaysUse && skillList[i].isReady) { readyList.Add(skillList[i]); } else if (skillList[i].isAlwaysUse) { skillList[i].UseSkill(); } } if (readyList.Count > 0) { int min = 0; int select = 0; for (int i = 0; i < readyList.Count; i++) { if (readyList[i].usePriority > min) { select = i; } } selectedSkill = readyList[select]; } else { selectedSkill = null; } if (selectedSkill is SkillWithUse) { selectedSkill.UseSkill(); } }
// Update is called once per frame void Update() { interaction = false; InputController.GetKey(); #region 切换视角 if (CameraController != null && GameController.GetCharacterNumber() == 2) { int mainCamera = CameraController.GetComponent <CameraAndCharacterController>().mainCamera; if (mainCamera == 0 && InputController.mouseDown) { CameraController.GetComponent <CameraAndCharacterController>().mainCamera = 1; CameraController.GetComponent <CameraAndCharacterController>().SendMessage("ChangeCamera"); } else if (mainCamera == 1 && InputController.buttonDown) { CameraController.GetComponent <CameraAndCharacterController>().mainCamera = 0; CameraController.GetComponent <CameraAndCharacterController>().SendMessage("ChangeCamera"); } } else if (GameController.GetCharacterNumber() != 2) { Debug.Log("这个场景的角色不是两个,所以不能切换视角!"); } #endregion #region 虚弱的人的移动 if (m_state == 0) { if (InputController.left) { gameObject.GetComponent <PoorManMoving>().SendMessage("MoveLeft"); audioSourceController.Play("人走路", transform); } else if (InputController.right) { gameObject.GetComponent <PoorManMoving>().SendMessage("MoveRight"); audioSourceController.Play("人走路", transform); } else if (InputController.interaction) { interaction = true; gameObject.GetComponent <PoorManMoving>().SendMessage("StopMoving"); audioSourceController.Stop(); audioSourceController = AudioSourcesManager.ApplyAudioSourceController(); return; } else { gameObject.GetComponent <PoorManMoving>().SendMessage("StopMoving"); audioSourceController.Stop(); audioSourceController = AudioSourcesManager.ApplyAudioSourceController(); return; } } #endregion #region 轮椅的移动 if (m_state == 1) { if (InputController.rush) { Skill rushSkill = GameObject.Find("技能UI/Canvas/Panel").transform.Find("技能1").GetComponent <Skill>(); if (rushSkill.IsAble()) { if (!rushSkill.isCD) { rushSkill.UseSkill(); //audioSourceController.Play("冲刺", transform); gameObject.GetComponent <ChairMoving>().SendMessage("Rush"); } } } if (InputController.left) { audioSourceController.Play("轮椅移动", transform); gameObject.GetComponent <ChairMoving>().SendMessage("MoveLeft"); } else if (InputController.right) { audioSourceController.Play("轮椅移动", transform); gameObject.GetComponent <ChairMoving>().SendMessage("MoveRight"); } else if (InputController.interaction) { interaction = true; gameObject.GetComponent <ChairMoving>().SendMessage("StopMoving"); audioSourceController.Stop(); audioSourceController = AudioSourcesManager.ApplyAudioSourceController(); return; } else { gameObject.GetComponent <ChairMoving>().SendMessage("StopMoving"); audioSourceController.Stop(); audioSourceController = AudioSourcesManager.ApplyAudioSourceController(); return; } } #endregion #region 健康人的移动 if (m_state == 2) { if (InputController.left) { gameObject.GetComponent <PlayerMoving>().SendMessage("IsMoving", true); gameObject.GetComponent <PlayerMoving>().SendMessage("MoveLeft"); audioSourceController.Play("人走路", transform); } else if (InputController.right) { gameObject.GetComponent <PlayerMoving>().SendMessage("IsMoving", true); gameObject.GetComponent <PlayerMoving>().SendMessage("MoveRight"); audioSourceController.Play("人走路", transform); } else if (InputController.interaction) { interaction = true; gameObject.GetComponent <PlayerMoving>().SendMessage("IsMoving", false); audioSourceController.Stop(); audioSourceController = AudioSourcesManager.ApplyAudioSourceController(); return; } else { gameObject.GetComponent <PlayerMoving>().SendMessage("IsMoving", false); audioSourceController.Stop(); audioSourceController = AudioSourcesManager.ApplyAudioSourceController(); return; } } #endregion #region 狗子的移动 if (m_state == 3) { GameObject plane = GameObject.FindGameObjectWithTag("Plane"); Vector3 target = new Vector3(InputController.hitPoint.x, InputController.hitPoint.y, plane.transform.position.z); if (InputController.right_mouseDown) { GetComponent <DogMoving>().SendMessage("JumpTo", target); } if (plane.GetComponent <Collider2D>().bounds.Contains(target)) { if (InputController.left_mouseDown) { GetComponent <DogMoving>().SendMessage("MoveTo", target); interaction = true; } } } #endregion }
public void UseSkill(Skill skill) { skill.UseSkill(this); }
void SelectArea(bool playersMustLive) { bool charAbove = false; bool charBelow = false; if (charSelectIndex < 4) { if (charSelectIndex > 0) { if (gameMaster.playerParty[charSelectIndex - 1].charName != "na" && (!playersMustLive || gameMaster.playerParty[charSelectIndex - 1].currentHP > 0)) { charAbove = true; } } if (charSelectIndex < 3) { if (gameMaster.playerParty[charSelectIndex + 1].charName != "na" && (!playersMustLive || gameMaster.playerParty[charSelectIndex + 1].currentHP > 0)) { charBelow = true; } } } else { if (charSelectIndex > 4) { if (enemyParty[charSelectIndex - 5].charName != "na" && enemyParty[charSelectIndex - 5].currentHP > 0) { charAbove = true; } } if (charSelectIndex < 7) { if (enemyParty[charSelectIndex - 3].charName != "na" && enemyParty[charSelectIndex - 3].currentHP > 0) { charBelow = true; } } } if (charAbove && charBelow) { charsSelected = new int[2] { charSelectIndex - 1, charSelectIndex + 1 } } ; else { if (charAbove) { charsSelected = new int[1] { charSelectIndex - 1 } } ; else { charsSelected = new int[1] { charSelectIndex + 1 } }; } } void SelectAll(bool playersMustLive) { bool[] charsSelected = new bool[8]; int charsAliveCount = 0; for (int i = 0; i < 8; i++) { if (i < 4) { if (gameMaster.playerParty[i].charName != "na" && (!playersMustLive || gameMaster.playerParty[i].currentHP > 0)) { charsAliveCount++; charsSelected[i] = true; } } else { if (enemyParty[i - 4].charName != "na" && enemyParty[i - 4].currentHP > 0) { charsAliveCount++; charsSelected[i] = true; } } } this.charsSelected = new int[charsAliveCount]; for (int i = 0; i < this.charsSelected.Length; i++) { for (int k = 0; k < charsSelected.Length; k++) { if (charsSelected[k]) { this.charsSelected[i] = k; charsSelected[k] = false; break; } } } } void MenuConfirm() { if (currentMenu != RpgMenu.SelectChar) { prevMenu = currentMenu; } switch (currentMenu) { case RpgMenu.Main: switch (mainIndex) { case 0: currentMenu = RpgMenu.Attack; break; case 1: currentMenu = RpgMenu.Skill; break; case 2: currentMenu = RpgMenu.Item; break; case 3: currentMenu = RpgMenu.Escape; break; } break; case RpgMenu.Attack: currentMenu = RpgMenu.SelectChar; break; case RpgMenu.Skill: currentMenu = RpgMenu.SelectChar; break; case RpgMenu.Item: currentMenu = RpgMenu.SelectChar; break; case RpgMenu.SelectChar: switch (prevMenu) { case RpgMenu.Attack: switchToSTG = true; break; case RpgMenu.Skill: usingSkill = true; break; } battleUI.CharacterCursors(-1, new int[0]); break; } menuInteractionDelay = 10; battleUI.ChangeBattleMenu(); } int[] TargetHandling() { int[] allTargets = new int[charsSelected.Length + ((charSelectIndex != -1) ? 1 : 0)]; if (charSelectIndex != -1) { allTargets[0] = charSelectIndex; } for (int i = 0; i < charsSelected.Length; i++) { allTargets[i + ((charSelectIndex != -1) ? 1 : 0)] = charsSelected[i]; } return(allTargets); } void MenuBack() { switch (currentMenu) { case RpgMenu.Attack: currentMenu = RpgMenu.Main; break; case RpgMenu.Skill: currentMenu = RpgMenu.Main; break; case RpgMenu.Item: currentMenu = RpgMenu.Main; break; case RpgMenu.SelectChar: currentMenu = prevMenu; charsSelected = new int[0]; charSelectIndex = -1; battleUI.CharacterCursors(charSelectIndex, charsSelected); break; } menuInteractionDelay = 10; battleUI.ChangeBattleMenu(); } void UseSkill(Character caster, Character[] targets, SkillData skill) { Skill.UseSkill(skill, caster, targets); } void EnemyTurn() { currentMenu = RpgMenu.None; battleUI.ChangeBattleMenu(); Debug.Log("Enemy " + (currentTurn - 4).ToString() + " (" + enemyParty[currentTurn - 4].charName + ")'s turn"); switchToSTG = true; } void SwitchToSTG(int playerTarget, RpgEnemy enemyAttacker, int patternIndex, bool spell) { camAnimations.SetBool("BulletHell", true); shmupManager.endSTG = false; shmupManager.SpawnPlayer(gameMaster.playerParty[playerTarget].shmupData, gameMaster.playerParty[playerTarget].shotTypeEquip, playerTarget, gameMaster.playerParty[playerTarget].damageTypeUnlocks[attackSelectIndex].damageType, gameMaster.playerParty[playerTarget].statusEffects.ToArray()); shmupManager.SpawnEnemy(enemyAttacker.shmupSpawn, enemyAttacker.weaknessesAndResistances, 120, new Vector2(0, 275), patternIndex, spell); gameMaster.lockInputs = true; switchToSTG = false; switchingToSTG = true; } void InitializeSTG(int player, GameMasterScript.DamageTypes damageType, RpgEnemy enemy, int patternIndex, bool spell) { shmupManager.SpawnPlayer(gameMaster.playerParty[player].shmupData, gameMaster.playerParty[player].shotTypeEquip, player, damageType, gameMaster.playerParty[player].statusEffects.ToArray()); shmupManager.SpawnEnemy(enemy.shmupSpawn, enemy.weaknessesAndResistances, 120, new Vector2(0, 275), patternIndex, spell); } void SwitchToRPG() { camAnimations.SetBool("BulletHell", false); mainCam.gameObject.SetActive(true); inSTG = false; returningToRpg = true; } IEnumerator SwitchToSTGCam() { switchToSTG = false; switchingToSTG = true; shmupManager.startingSTG = true; shmupManager.endSTG = false; camAnimations.SetBool("BulletHell", true); StartCoroutine(battleUI.FadeRPGMenu(false)); gameMaster.lockInputs = true; do { yield return(null); } while (!battleUI.FadeBlackscreen(true)); int delayCounter = 5; do { delayCounter--; yield return(null); } while (delayCounter > 0); mainCam.gameObject.SetActive(false); shmupManager.blackScreen.color = new Color(0, 0, 0, 1); shmupManager.shmupCam.gameObject.SetActive(true); inSTG = true; switchingToSTG = false; if (currentTurn > 3) { int player = Random.Range(0, 2); InitializeSTG(player, gameMaster.playerParty[player].damageTypeUnlocks[0].damageType, enemyParty[currentTurn - 4], 0, true); } else { InitializeSTG(currentTurn, gameMaster.playerParty[currentTurn].damageTypeUnlocks[attackSelectIndex].damageType, enemyParty[charSelectIndex - 4], 0, usingSkill); } do { shmupManager.blackScreen.color = new Color(0, 0, 0, shmupManager.blackScreen.color.a - (gameMaster.timeScale * 0.025f)); yield return(null); } while (shmupManager.blackScreen.color.a > 0); gameMaster.lockInputs = false; shmupManager.startingSTG = false; shmupManager.inSTG = true; } IEnumerator SwitchToRPGCam() { inSTG = false; shmupManager.inSTG = false; returningToRpg = true; gameMaster.lockInputs = true; do { shmupManager.blackScreen.color = new Color(0, 0, 0, shmupManager.blackScreen.color.a + (gameMaster.timeScale * 0.025f)); yield return(null); } while (shmupManager.blackScreen.color.a < 1); shmupManager.DestroySTG(); int delayCounter = 5; do { delayCounter--; yield return(null); } while (delayCounter > 0); camAnimations.SetBool("BulletHell", false); mainCam.gameObject.SetActive(true); battleUI.InstantBlackscreen(true); shmupManager.shmupCam.gameObject.SetActive(false); returningToRpg = false; entranceDelayPassed = 0; do { yield return(null); } while (!battleUI.FadeBlackscreen(false)); StartCoroutine(battleUI.FadeRPGMenu(true)); gameMaster.lockInputs = false; } }
public void Evt_ActivateSkill(Skill skill) { skill.UseSkill(Skill.Type.Physical, _player, _enemy); }
void Update() { if (HP <= 0) { return; } Display(); if (ShieldE > 1000) { ShieldE = 1000; } EnergyT.text = ShieldE + "/1000"; EBar.GetComponentInChildren <RectTransform>().sizeDelta = new Vector2(1.168f * ShieldE, EBar.GetComponentInChildren <RectTransform>().sizeDelta.y ); HPBar.GetComponentInChildren <RectTransform>().sizeDelta = new Vector2(width1hp * HP, HPBar.GetComponentInChildren <RectTransform>().sizeDelta.y ); HPT.text = HP + "/2000"; RaycastHit2D hit = Physics2D.Raycast(rayPoint.transform.position, new Vector2(0, -10), 20); if (hit.collider != null) { if (hit.collider.gameObject.tag == "Background") { hit.collider.isTrigger = false; } } if (!transform.GetChild(0).GetComponent <Animator>().GetBool("Ult") && !transform.GetChild(0).GetComponent <Animator>().GetBool("3QS")) { Movement(); } if (ItemList.Contains("스태틱")) { if (staticCharge >= 100) { staticCharge = 0; Instantiate(Lightning, Target.transform.position, Quaternion.identity); } staticChargeImage.transform.GetChild(0).GetComponent <Text>().text = ((int)staticCharge).ToString(); } if (Input.GetKey(KeyCode.LeftControl) && CanControlAttack) { StopCoroutine("Timer"); CanControlAttack = false; StartCoroutine("Timer"); GameObject CEffect = Instantiate(AttackEffect1, new Vector3(transform.position.x + 0.8f, transform.position.y, 0), Quaternion.identity); CEffect.transform.parent = gameObject.transform; animator.SetBool("LeftControl", true); transform.GetChild(0).GetChild(1).GetComponent <NormalAttack>().NormalEffect(); } else if (Input.GetKeyUp(KeyCode.LeftControl)) { animator.SetBool("LeftControl", false); } if (Input.GetKey(KeyCode.Q) && QScript.canUseSkill) { if (!EAction) { if (QStack == 2) { QStack = 0; GameObject.Find("QS").GetComponent <Text>().text = QStack + ""; animator.SetBool("3QS", true); } else { animator.SetBool("QSkill", true); } } else { animator.SetBool("EQS", true); transform.GetChild(0).GetChild(3).GetComponent <EQSkill>().EEffect(); } GameObject.Find("CoolTime Q").SendMessage("UseSkill"); } if (Input.GetKey(KeyCode.E) && EScript.canUseSkill) { EAction = true; for (int i = 0; i < 7; i++) { GameObject.Find("잔상").transform.GetChild(i).GetComponent <SpriteRenderer>().enabled = true; } int move = transform.localScale.x < 0 ? -1 : 1; if (move == -1) { if (transform.position.x - 15 < GameObject.Find("EndLeft").transform.position.x) { GameObject.Find("잔상").transform.position = new Vector3( GameObject.Find("EndLeft").transform.position.x, transform.position.y, 0); } else { GameObject.Find("잔상").transform.position = new Vector3( transform.position.x - 15, transform.position.y, 0); } } else { if (transform.position.x + 15 > GameObject.Find("EndRight").transform.position.x) { GameObject.Find("잔상").transform.position = new Vector3( GameObject.Find("EndRight").transform.position.x, transform.position.y, 0); } else { GameObject.Find("잔상").transform.position = new Vector3( transform.position.x + 15, transform.position.y, 0); } } } if (Input.GetKeyUp(KeyCode.E) && EScript.canUseSkill) { EAction = true; StartCoroutine(ESKillM()); transform.GetChild(4).GetComponent <ParticleSystem>().Play(); transform.GetChild(0).GetChild(2).GetComponent <ESkillEffect>().EEffect(); GameObject.Find("CoolTime E").SendMessage("UseSkill"); transform.position = GameObject.Find("잔상").transform.position; for (int i = 0; i < 7; i++) { GameObject.Find("잔상").transform.GetChild(i).GetComponent <SpriteRenderer>().enabled = false; } } if (Input.GetKeyDown(KeyCode.R) && RScript.canUseSkill && IsThereAirboned()) { RScript.UseSkill(); GameObject[] gameObjects = GetAirbonedMonsters(); float avX = 0; int cnt = 0; float sum = 0; foreach (GameObject item in gameObjects) { if (item.name.Contains("Wolf")) { item.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionY; item.GetComponent <Wolf>().CantMove = true; } else if (item.name.Contains("Bird")) { item.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePositionY; item.GetComponent <Bird>().CantMove = true; } sum += item.transform.position.x; cnt++; } avX = sum / cnt; transform.position = new Vector3(avX, transform.position.y, transform.position.z); Camera.main.transform.position = new Vector3(transform.position.x, transform.position.y, Camera.main.transform.position.z); transform.GetChild(0).GetComponent <UltEffect>().avX = avX; transform.GetChild(0).GetComponent <UltEffect>().Monsters = gameObjects; transform.GetChild(0).GetComponent <Animator>().SetBool("Ult", true); } if (Input.GetKey(KeyCode.W) && WScript.canUseSkill && Application.loadedLevelName == "Fight") { if (!Target) { return; } WScript.UseSkill(); Target.GetComponent <MonsterInfo>().hp -= Target.GetComponent <MonsterInfo>().maxHp / 100 * 20; HP += (int)(Target.GetComponent <MonsterInfo>().maxHp * 0.4f + stats.AP); } if (HP > 2000) { HP = 2000; } }
public bool UseSkill(Skill skill, bool selfTarget = false, bool autoCome = true) { if (skill == null) { return(false); } while (IsCasting()) { Utils.Delay(50, token); } if (autoCome && !selfTarget) { double dist = CalcMaxSkillRange(skill); if (dist > 0) { double comeDist = (dist <= 4) ? Utils.Rand(0.8, 2) : dist - 1.5; if ((TargetDist() > dist) && !ComeToTarget(comeDist, false)) { // Failed coming to target... return(false); } } } bool result = false; SelectTarget(); if (skill.TargetType() != TargetType.Location) { result = skill.UseSkill(false, selfTarget); } else { result = Host.UseSkill(skill.id, Target.X, Target.Y, Target.Z, false); } while (IsCasting()) { Utils.Delay(50, token); } if (!result && autoCome) { var error = Host.GetLastError(); if (TargetDist() >= 3.5 && (error == LastError.NoLineOfSight || error == LastError.TargetTooFarAway)) { ComeToTarget(TargetDist() - 2.5, false); } } return(result); }
// スキル使用 public void Skill() { _skill.UseSkill(); }
void UseSkill() { if (CurrentSkillStatus != SkillStatus.useSkill) { return; } if (_selectedSkill.targetType != TargetType.Position) { var targets = new List <Character>(); switch (_selectedSkill.targetCount) { case TargetAmount.Single: targets.Add(_selectedTarget); break; case TargetAmount.Multiple: if (_selectedSkill.targetSite == TargetSite.Enemy) { foreach (var chars in controller.allCharacters) { if (chars.Key < 0 && _selectedSkill.CheckForPossibleTarget(chars.Value.position)) { targets.Add(chars.Value); } } } else if (_selectedSkill.targetSite == TargetSite.Team) { foreach (var chars in controller.allCharacters) { if (chars.Key > 0 && _selectedSkill.CheckForPossibleTarget(chars.Value.position)) { targets.Add(chars.Value); } } } break; case TargetAmount.All: if (_selectedSkill.targetSite == TargetSite.Enemy) { foreach (var chars in controller.allCharacters) { if (chars.Key < 0) { targets.Add(chars.Value); } } } else if (_selectedSkill.targetSite == TargetSite.Team) { foreach (var chars in controller.allCharacters) { if (chars.Key > 0) { targets.Add(chars.Value); } } } break; case TargetAmount.GlobalAll: foreach (var chars in controller.allCharacters) { targets.Add(chars.Value); } break; } _selectedSkill.UseSkill(_currentChar, targets.ToArray(), this); } else { // _selectedSkill.UseSkill(_currentChar, this); } EndTurn(); }
// Update is called once per frame void Update() { if (m_playingSkillAnimation || m_playingItemAnimation) { return; } if (EventSystem.current.currentSelectedGameObject == null) { r_attackButton.Select(); } if (m_enemies == 0) { Victory(); } switch (m_battleState) { case BattleState.BATTLESTATE_START: break; case BattleState.BATTLESTATE_PLAYER_TURN: if (Input.GetAxis("Horizontal") < 0.1 && Input.GetAxis("Horizontal") > -0.1 && Input.GetAxis("Vertical") < 0.1 && Input.GetAxis("Vertical") > -0.1 && Input.GetAxis("Submit") > 0.1 && Input.GetAxis("Cancel") > 0.1) { m_inputTimer = m_inputDelay; } if (m_inputTimer < m_inputDelay) { m_inputTimer += Time.deltaTime; return; } switch (m_selectedCommand) { case Command.COMMAND_NONE: break; case Command.COMMAND_ATTACK: BattleCursorMovement(); if (Input.GetAxis("Submit") > 0.1) { m_inputTimer = 0; if (m_battleSpaces[m_selectionX, m_selectionY].m_selectable && m_battleSpaces[m_selectionX, m_selectionY].m_occupied) { foreach (BattleSpace space in m_SelectableSpaces) { space.m_cube.GetComponent <MeshRenderer>().material = m_materialNormal; space.m_selectable = false; } foreach (BattleSpace space in m_battleSpaces) { if (space.m_occupied) { space.m_pawn.r_turnMarker.SetActive(false); space.m_pawn.r_myTurnMarker.SetActive(false); } } m_SelectableSpaces.Clear(); //ATTACK CODE m_currentTurnPawn.Attack(m_selectionX, m_selectionY, new Vector3(m_battleSpaces[m_selectionX, m_selectionY].m_cube.transform.position.x, m_currentTurnPawn.transform.position.y, m_battleSpaces[m_selectionX, m_selectionY].m_cube.transform.position.z)); } } if (Input.GetAxis("Cancel") > 0.1) { m_inputTimer = 0; AttackEnd(true); } break; case Command.COMMAND_SKILL: if (Input.GetAxis("Cancel") > 0.1) { m_inputTimer = 0; SkillEnd(true); return; } if (!m_isAimingSkill) { return; } BattleCursorMovement(); if (Input.GetAxis("Submit") > 0.1) { m_inputTimer = 0; if (r_selectedSkill.ValidTarget(m_currentTurnPawn, m_selectionX, m_selectionY)) { foreach (BattleSpace space in m_SelectableSpaces) { space.m_cube.GetComponent <MeshRenderer>().material = m_materialNormal; space.m_selectable = false; } foreach (BattleSpace space in m_battleSpaces) { if (space.m_occupied) { space.m_pawn.r_turnMarker.SetActive(false); space.m_pawn.r_myTurnMarker.SetActive(false); } } m_SelectableSpaces.Clear(); r_selectedSkill.UseSkill(m_currentTurnPawn, m_selectionX, m_selectionY); } } break; case Command.COMMAND_ITEM: if (Input.GetAxis("Cancel") > 0.1) { m_inputTimer = 0; ItemEnd(true); return; } if (!m_isAimingItem) { return; } BattleCursorMovement(); if (Input.GetAxis("Submit") > 0.1) { m_inputTimer = 0; if (r_selectedItem.ValidTarget(m_currentTurnPawn, m_selectionX, m_selectionY)) { foreach (BattleSpace space in m_SelectableSpaces) { space.m_cube.GetComponent <MeshRenderer>().material = m_materialNormal; space.m_selectable = false; } m_SelectableSpaces.Clear(); foreach (BattleSpace space in m_battleSpaces) { if (space.m_occupied) { space.m_pawn.r_turnMarker.SetActive(false); space.m_pawn.r_myTurnMarker.SetActive(false); } } r_selectedItem.UseItem(m_currentTurnPawn, m_selectionX, m_selectionY); } } break; case Command.COMMAND_MOVE: BattleCursorMovement(); if (Input.GetAxis("Submit") > 0.1) { m_inputTimer = 0; if (m_battleSpaces[m_selectionX, m_selectionY].m_selectable) { foreach (BattleSpace space in m_SelectableSpaces) { space.m_cube.GetComponent <MeshRenderer>().material = m_materialNormal; space.m_selectable = false; } m_SelectableSpaces.Clear(); foreach (BattleSpace space in m_battleSpaces) { if (space.m_occupied) { space.m_pawn.r_turnMarker.SetActive(false); space.m_pawn.r_myTurnMarker.SetActive(false); } } m_currentTurnPawn.MoveTo(m_selectionX, m_selectionY, new Vector3(m_battleSpaces[m_selectionX, m_selectionY].m_cube.transform.position.x, m_currentTurnPawn.transform.position.y, m_battleSpaces[m_selectionX, m_selectionY].m_cube.transform.position.z)); MoveEnd(false); } } if (Input.GetAxis("Cancel") > 0.1) { m_inputTimer = 0; MoveEnd(true); } break; case Command.COMMAND_DEFEND: break; default: break; } break; case BattleState.BATTLESTATE_ENEMY_TURN: break; case BattleState.BATTLESTATE_WIN: if (m_inputTimer < m_inputDelay) { m_inputTimer += Time.deltaTime; return; } switch (m_victoryState) { case VictoryState.VICTORYSTATE_START: if (Input.GetAxis("Submit") > 0.1) { m_inputTimer = 0; LevelUp(); m_victoryState = VictoryState.VICTORYSTATE_LEVELUP; } break; case VictoryState.VICTORYSTATE_LEVELUP: if (Input.GetAxis("Submit") > 0.1) { m_inputTimer = 0; EndBattle(true); } break; case VictoryState.VICTORYSTATE_END: break; default: break; } break; case BattleState.BATTLESTATE_LOSE: break; case BattleState.BATTLESTATE_INBETWEENTURN: m_turnTimer -= Time.deltaTime; if (m_turnTimer <= 0) { foreach (BattlePawn pawn in m_charactersInBattle) { pawn.r_turnMarker.GetComponentInChildren <Text>().text = (pawn.m_timeUntilTurn).ToString(); if (pawn.m_timeUntilTurn == 0) { pawn.r_turnMarker.SetActive(false); pawn.r_myTurnMarker.SetActive(true); } else { pawn.r_turnMarker.SetActive(true); pawn.r_myTurnMarker.SetActive(false); } if (pawn.m_isDead) { pawn.r_turnMarker.SetActive(false); pawn.r_myTurnMarker.SetActive(false); } } m_currentTurnPawn.TakeTurn(); } break; default: break; } }
// Update is called once per frame void Update() { spriteRenderer.sortingOrder = -(int)(transform.position.y * 2); switch (currentState) { case PokemonState.Attack: if (!isOnAttack) { if (!IsAttackTargetInRange()) { currentState = PokemonState.Move; } else { attackCoroutine = AttackAction(); StartCoroutine(attackCoroutine); } } break; case PokemonState.Move: StartAnimation(); if (attackTarget != null && attackTarget.isAlive) { if (IsAttackTargetInRange()) { currentState = PokemonState.Attack; } } else { battleCallbackHandler.LostAttackTarget(this); } break; default: break; } if ((currentState == PokemonState.Attack || currentState == PokemonState.Move) && currentPp >= ppFull) { currentPp = 0; if (skill != null) { isOnAttack = false; StopAttack(); if (!CheckParalysis()) { currentState = PokemonState.Skill; Pokemon skillTarget = GetNearstEnemyPokemon(); skill.UseSkill(this, skillTarget); } } } if (isAlive) { UpdateStatus(); } }