/// <summary> /// MAX TARGETS 1 /// </summary> /// <param name="user"></param> /// <returns></returns> public override Panel[] GatherTargetPanels(NaviController_Battle user) { var targets = GatherTargets(user); var targetPanels = new Panel[1];//this type of attack only ever hits one target targetPanels[0] = targets[0].GetCurrentPanel(); return targetPanels; }
public override Panel[] GatherTargetPanels(NaviController_Battle user) { var panelList = new Panel[1];//this type of attack only hits one target //where is the user? user.GetCurrentPanelCoordinates(out int attackerX, out int attackerY); //ask the panel array what object is right in front of this user's coordinates panelList[0] = panelArray.GetPanel(attackerX + user.TargetingOrientation * squaresAhead, attackerY); return(panelList); }
public override NaviController_Battle[] GatherTargets(NaviController_Battle user) { var targetList = new NaviController_Battle[maxTargets];//this type of attack user.GetCurrentPanelCoordinates(out int x, out int y); x += user.TargetingOrientation * spacesInFront; //get one column in front of user targetList[0] = panelArray.GetOccupantAtCoordinates(x, y + 1); //one above targetList[1] = panelArray.GetOccupantAtCoordinates(x, y); //on same row targetList[2] = panelArray.GetOccupantAtCoordinates(x, y - 1); //one below return(targetList); }
public override NaviController_Battle[] GatherTargets(NaviController_Battle user) { var targetList = new NaviController_Battle[1];//this type of attack can only ever hit one target //where is the user? user.GetCurrentPanelCoordinates(out int attackerX, out int attackerY); //ask the panel array what object is right in front of this user's coordinates var occupantOnTargetPanel = panelArray.GetOccupantAtCoordinates(attackerX + user.TargetingOrientation * squaresAhead, attackerY); if (occupantOnTargetPanel) {//if something exists on this spot... targetList[0] = occupantOnTargetPanel.GetComponent <NaviController_Battle>() as NaviController_Battle; } return(targetList); }
/// <summary> /// Do the things the attack does. /// </summary> /// <param name="naviController">The navi using the ability.</param> public virtual IEnumerator TriggerAttack(NaviController_Battle naviController, Animator naviAnimator) { naviAnimator.SetTrigger(animatorMessage); yield return new WaitForSeconds(drawDelay); //get targets using targeting behavior var targets = targetingBehavior.GatherTargets(naviController); //handle damage foreach (var target in targets) { if (target) { target.TakeDamage(damage, element); //TODO give status ailment if you have one } } }
/// <summary> /// MAX TARGETS 1 /// </summary> /// <param name="user"></param> /// <returns></returns> public override NaviController_Battle[] GatherTargets(NaviController_Battle user) { var targetList = new NaviController_Battle[1];//this type of attack can only ever hit one target var userXform = user.transform; var raycastHitInfo = Physics2D.Raycast(user.transform.position, user.transform.right * user.TargetingOrientation, PanelArray.globalScale); if (raycastHitInfo) { //Debug.Log("ZAP! I shot and hit: " + raycastHitInfo.collider.name); targetList[0] = raycastHitInfo.collider.gameObject.GetComponent<NaviController_Battle>() as NaviController_Battle; } else { //Debug.Log("ZAP! I shot but missed."); } return targetList; }
public override IEnumerator TriggerAttack(NaviController_Battle naviController, Animator naviAnimator) { //immediately check to see if you can step var targetPanels = stepTargetingBehavior.GatherTargetPanels(naviController); if (!targetPanels[0]) { yield break; //if there's nothing, do nothing } var currentPanel = naviController.GetCurrentPanel(); //cache current panel to return to it after attack //step, can even go into enemy territory naviController.MoveNavi(targetPanels[0], true);//can only move to single, first panel //wait to draw yield return(new WaitForSeconds(drawDelay)); naviAnimator.SetTrigger(animatorMessage); //get targets using targeting behavior (ie wide sword, short sword, long sword) var targets = targetingBehavior.GatherTargets(naviController); //handle damage foreach (var target in targets) { if (target) { target.TakeDamage(damage, element); //TODO give status ailment if you have one } } yield return(new WaitForSeconds(attackWaitTime)); //step back no matter what naviController.MoveNavi(currentPanel);//can only move to single, first panel }
public static void OnCombatantDeath(NaviController_Battle deadNavi) { //Display win Text deadNavi.StartCoroutine(ReturnToCharacterSelectionScreen());//WHY USE DEADNAVI AS OBJECT REFERENCE TO START COROUTINE? why not? }
/// <summary> /// Get a list of the panels that this behavior is targeting (the panels on which the targets are standing) /// </summary> /// <param name="user"></param> /// <returns></returns> public abstract Panel[] GatherTargetPanels(NaviController_Battle user);
public abstract NaviController_Battle[] GatherTargets(NaviController_Battle user);