コード例 #1
0
 void RangeAttack(TP_Info enemyInfo, int enemyID, int force, TP_Animator.HitWays hitWay)
 {
     if (IsAIButNotMasterClients())
     {
         return;
     }
     if ((int)enemyInfo.GetVital((int)VitalName.Health).CurValue > 0)
     {
         if (myPhotonView.isMine)
         {
             roomMenu.Hit(myPhotonView.viewID, enemyID, force, hitWay, HitSound.None);
         }
     }
 }
コード例 #2
0
 public void MeleeAttackInput(float attDistance, float attAngle, int force, TP_Animator.HitWays hitWay)
 {
     tempList.Clear();
     if (IsAIButNotMasterClients())
     {
         return;
     }
     if (!playerInfo.isAI)
     {
         StartCoroutine(MeleeAttackCheckAfterSnapToCamera(attDistance, attAngle, force, hitWay));
     }
     else
     {
         MeleeAttackCheck(attDistance, attAngle, force, hitWay);
     }
 }
コード例 #3
0
 IEnumerator MeleeAttackCheckAfterSnapToCamera(float attDistance, float attAngle, int force, TP_Animator.HitWays hitWay)
 {
     while ((Camera.main.transform.eulerAngles.y - parentTrans.eulerAngles.y) > 5)
     {
         yield return(new WaitForSeconds(0.005f));
     }
     MeleeAttackCheck(attDistance, attAngle, force, hitWay);
     StopCoroutine("MeleeAttackCheckAfterSnapToCamera");
 }
コード例 #4
0
    void MeleeAttackCheck(float attDistance, float attAngle, int force, TP_Animator.HitWays hitWay)
    {
        if (IsAIButNotMasterClients())
        {
            return;
        }
        for (int cnt = 0; cnt < attackList.Count; cnt++)
        {
            Transform enemy = attackList[cnt];

            if (enemy == null)
            {
                attackList.Remove(enemy);
            }
            else
            {
                if (enemy != parentTrans)
                {
                    Vector3 targetDir = enemy.transform.position - parentTrans.position;

                    Vector3 dir   = targetDir.normalized;
                    float   angle = Vector3.Dot(dir, parentTrans.forward);
//					Debug.Log("Name:" + enemy.name +  " Dis:" + Vector3.Magnitude(targetDir) + "A:" + angle);

                    if (Vector3.Magnitude(targetDir) <= attDistance && angle > attAngle)
                    {
                        if (!tempList.Contains(enemy))
                        {
                            tempList.Add(enemy);
                        }
                    }
                }
            }
        }

        if (tempList.Count > 0)
        {
            HitSound sound = HitSound.None;
            if (playerInfo.Role == TP_Info.CharacterRole.Mars)
            {
                sound = HitSound.Sword1;
            }
            else if (playerInfo.Role == TP_Info.CharacterRole.DarkMan)
            {
                sound = HitSound.Sword2;
            }
            else if (playerInfo.Role == TP_Info.CharacterRole.Steropi)
            {
                sound = HitSound.Fist;
            }
            else if (playerInfo.Role == TP_Info.CharacterRole.Hyperion)
            {
                sound = HitSound.Slap;
            }
            for (int cnt = 0; cnt < tempList.Count; cnt++)
            {
                foreach (Transform enemy in tempList)
                {
                    //Transform enemy = attackList[cnt];
                    if (enemy == null)
                    {
                        tempList.Remove(enemy);
                    }
                    else
                    {
                        PhotonView enemyPV = enemy.GetComponent <PhotonView>();
                        if (enemyPV != null)
                        {
                            int     enemyID   = enemyPV.viewID;
                            TP_Info enemyInfo = enemy.GetComponent <TP_Info>();
                            if ((int)enemyInfo.GetVital((int)VitalName.Health).CurValue > 0)
                            {
                                Debug.Log(enemyInfo.gameObject.name + " got hit!");
                                if (myPhotonView.isMine)
                                {
                                    roomMenu.Hit(myPhotonView.viewID, enemyID, force, hitWay, sound);
                                }
                            }
                        }
                    }
                }
            }
        }
        tempList.Clear();
    }
コード例 #5
0
    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));
        }
    }