IEnumerator SpurtMove(float distance, RangeColliderAttack RCA, int force, float waitTime) { yield return(new WaitForSeconds(waitTime)); Vector3 parentPos = parentTrans.position; float movement = parentPos.z; float goal = movement - distance; float speed = 1.5f; float rate = 1.4f; Vector3 dir = parentTrans.forward; IgnoreCollision(true); while (movement > goal) { movement = movement - rate; if (movement <= goal) { RangeSpurtAttack(RCA, force); StopCoroutine("SpurtMove"); } CC.Move(dir * speed); yield return(null); } RCA.ClearList(); }
IEnumerator WaitClearList(RangeColliderAttack RCA) { yield return(new WaitForSeconds(2)); RCA.ClearList(); RCA.gameObject.SetActive(false); }
void RangeSpurtAttack(RangeColliderAttack RCA, int force) { List <Transform> skillAttackList = RCA.attackList; IgnoreCollision(false); tempList.Clear(); foreach (Transform enemy in skillAttackList) { if (enemy != null) { tempList.Add(enemy); } } foreach (Transform enemy in tempList) { Debug.Log("enemy: " + enemy.name); PhotonView enemyPV = enemy.GetComponent <PhotonView>(); if (enemyPV != null) { int enemyID = enemyPV.viewID; TP_Info enemyInfo = enemy.GetComponent <TP_Info>(); RangeAttack(enemyInfo, enemyID, force, TP_Animator.HitWays.KnockDown); } } }
public void RangeSkillInput(TP_Animator.Skilltype skillType, RangeColliderAttack RCA, int force, TP_Animator.HitWays hitWay) { if (skillType == TP_Animator.Skilltype.Attack || skillType == TP_Animator.Skilltype.Darkman_Freeze || skillType == TP_Animator.Skilltype.Mars_Stun || skillType == TP_Animator.Skilltype.Persia_Curse) { List <Transform> skillAttackList = RCA.attackList; tempList.Clear(); foreach (Transform enemy in skillAttackList) { if (enemy != null) { tempList.Add(enemy); } } foreach (Transform enemy in tempList) { Debug.Log("enemy: " + enemy.name); PhotonView enemyPV = enemy.GetComponent <PhotonView>(); if (enemyPV != null) { int enemyID = enemyPV.viewID; TP_Info enemyInfo = enemy.GetComponent <TP_Info>(); switch (skillType) { case TP_Animator.Skilltype.Attack: RangeAttack(enemyInfo, enemyID, force, hitWay); break; case TP_Animator.Skilltype.Darkman_Freeze: RangeFreeze(enemyID, force); break; case TP_Animator.Skilltype.Mars_Stun: RangeDizzyFire(enemyID, force); break; case TP_Animator.Skilltype.Persia_Curse: RangePersiaDecreaseDefense(enemyID, force); break; /*case TP_Animator.Skilltype.DecreseDefense: * break;*/ } } } } else if (skillType == TP_Animator.Skilltype.Darkman_Spurt) { if (IsAIButNotMasterClients()) { return; } StartCoroutine(SpurtMove(10, RCA, force, 0.4f)); } else if (skillType == TP_Animator.Skilltype.Steropi_RollingStrike) { if (IsAIButNotMasterClients()) { return; } StartCoroutine(SpurtMove(15, RCA, force, 0.4f)); } else if (skillType == TP_Animator.Skilltype.Mars_Assault) { if (IsAIButNotMasterClients()) { return; } StartCoroutine(SpurtMove(10, RCA, force, 0.4f)); } else if (skillType == TP_Animator.Skilltype.Darkman_AddDefense || skillType == TP_Animator.Skilltype.Hyperion_AddDefense) { RoleAddDefense(force, playerInfo.Role); } else if (skillType == TP_Animator.Skilltype.Hyperion_Unbeatable) { HyperionUnbeatable(force); } else if (skillType == TP_Animator.Skilltype.Mars_AddAttack || skillType == TP_Animator.Skilltype.Steropi_AddAttack) { RoleAddAttack(force, playerInfo.Role); } else if (skillType == TP_Animator.Skilltype.AddHealth || skillType == TP_Animator.Skilltype.Theia_AddDefense) { List <Transform> skillHelpList = RCA.TeammateList; tempList.Clear(); foreach (Transform teammate in skillHelpList) { if (teammate != null) { tempList.Add(teammate); } } foreach (Transform teammate in tempList) { Debug.Log("teammate: " + teammate.name); int teammatePlayerID = teammate.GetComponent <PhotonView>().viewID; TP_Info teammateInfo = teammate.GetComponent <TP_Info>(); switch (skillType) { case TP_Animator.Skilltype.AddHealth: RangeAddHealth(teammatePlayerID, force); break; case TP_Animator.Skilltype.Theia_AddDefense: RangeTheiaAddDefense(teammatePlayerID, force); break; } } } if (skillType != TP_Animator.Skilltype.Darkman_Spurt && skillType != TP_Animator.Skilltype.Steropi_RollingStrike && skillType != TP_Animator.Skilltype.Mars_Assault) { RCA.ClearList(); RCA.gameObject.SetActive(false); } else { StartCoroutine(WaitClearList(RCA)); } }