Example #1
0
 void IPunObservable.OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     if (stream.isWriting)
     {
         stream.SendNext(nationality);
         stream.SendNext(word);
         stream.SendNext(heroskill);
         stream.SendNext(force);
         stream.SendNext(intelligence);
         stream.SendNext(dominance);
         stream.SendNext(politics);
         stream.SendNext(allegiance);
         stream.SendNext(charm);
         stream.SendNext(price);
     }
     else if (stream.isReading)
     {
         nationality  = (WorldObj.Nationality)stream.ReceiveNext();
         word         = (string)stream.ReceiveNext();
         heroskill    = (WorldObj.HeroSkill)stream.ReceiveNext();
         force        = (int)stream.ReceiveNext();
         intelligence = (int)stream.ReceiveNext();
         dominance    = (int)stream.ReceiveNext();
         politics     = (int)stream.ReceiveNext();
         allegiance   = (int)stream.ReceiveNext();
         charm        = (int)stream.ReceiveNext();
         price        = (int)stream.ReceiveNext();
     }
 }
Example #2
0
 public void AssignHeroSkill(WorldObj.HeroSkill _heroskill)
 {
     heroskill = _heroskill;
 }
Example #3
0
 /// <summary>
 /// 分配武将技
 /// </summary>
 public void GiveHeroSkill(WorldObj.HeroSkill _heroskill)
 {
     photonView.RPC("AssignHeroSkill", PhotonTargets.All, _heroskill);
 }
Example #4
0
        /// <summary>
        /// 沉默倒计时,计时完毕恢复
        /// </summary>
        /// <param name="_totaltime">倒计时总时间</param>
        /// <param name="_objTeam">英雄</param>
        /// <returns></returns>
        IEnumerator HeroSkillSilenceCountDownRestore(float _totaltime, HeroObj _objHero, WorldObj.HeroSkill _originalSkill)
        {
            yield return(new WaitForSeconds(_totaltime));

            _objHero.GiveHeroSkill(_originalSkill);
        }
Example #5
0
        /// <summary>
        /// 英雄使用英雄技
        /// </summary>
        /// <param name="_objTeam">目标队伍</param>
        public void HeroUseSkill(TeamObj _objTeam)
        {
            if (!clickSkill)
            {
                return;
            }
            clickSkill = false;

            //如果本队伍是工兵,则不适用英雄技
            if (teamObj.soldiertype == WorldObj.SoldierType.Worker ||
                teamObj.soldiertype == WorldObj.SoldierType.Tank)
            {
                return;
            }
            //判断目标队伍距离
            if (Vector3.Distance(_objTeam.transform.position, teamObj.transform.position) > WorldObj.SkillDistance)
            {
                return;
            }

            switch (WorldObj.MatchHero(teamObj.hero).heroskill)
            {
            case WorldObj.HeroSkill.none:
                break;

            case WorldObj.HeroSkill.IncreaseOwnSpeed:
                if (_objTeam.nationality == countryObj.nationality)
                {
                    //急行军倒计时,计时完毕恢复初始速度
                    _objTeam.UpdateTeamNAVSpeed(WorldObj.IncreaseOwnSpeedCoefficient * _objTeam.GetComponent <NavMeshAgent>().speed);
                    StartCoroutine(TeamSpeedCountDownRestore(WorldObj.IncreaseOwnSpeedTime, _objTeam));
                    // 英雄技能进入冷却
                    HeroSkillCoolDown();
                }
                break;

            case WorldObj.HeroSkill.ReduceEnemySpeed:
                if (_objTeam.nationality != countryObj.nationality)
                {
                    //缓慢倒计时,计时完毕恢复初始速度
                    _objTeam.UpdateTeamNAVSpeed(WorldObj.ReduceEnemySpeedCoefficient * _objTeam.GetComponent <NavMeshAgent>().speed);
                    StartCoroutine(TeamSpeedCountDownRestore(WorldObj.ReduceEnemySpeedTime, _objTeam));
                    // 英雄技能进入冷却
                    HeroSkillCoolDown();
                }
                break;

            case WorldObj.HeroSkill.Disorient:
                if (_objTeam.nationality != countryObj.nationality)
                {
                    //迷惑减低军心
                    _objTeam.UpdateTeamMorale(Mathf.RoundToInt(WorldObj.DisorientCoefficient * _objTeam.GetComponent <TeamObj>().teammorale));
                    // 英雄技能进入冷却
                    HeroSkillCoolDown();
                }
                break;

            case WorldObj.HeroSkill.Encourage:
                if (_objTeam.nationality == countryObj.nationality)
                {
                    //鼓舞提升军心
                    _objTeam.UpdateTeamMorale(Mathf.RoundToInt(WorldObj.EncourageCoefficient * _objTeam.GetComponent <TeamObj>().teammorale));
                    // 英雄技能进入冷却
                    HeroSkillCoolDown();
                }
                break;

            case WorldObj.HeroSkill.Silence:
                if (_objTeam.nationality != countryObj.nationality)
                {       //保存原技能
                    HeroObj            objHero       = WorldObj.MatchHero(_objTeam.hero);
                    WorldObj.HeroSkill originalSkill = objHero.heroskill;
                    //沉默对手
                    objHero.GiveHeroSkill(WorldObj.HeroSkill.none);
                    //计时结束后恢复对手
                    StartCoroutine(HeroSkillSilenceCountDownRestore(WorldObj.SilenceTime, objHero, originalSkill));
                    // 英雄技能进入冷却
                    HeroSkillCoolDown();
                }
                break;

            case WorldObj.HeroSkill.Disease:
                if (_objTeam.nationality != countryObj.nationality)
                {
                    //瘟疫降低敌方队伍人数
                    _objTeam.UpdateSoldierNumber(Mathf.RoundToInt(WorldObj.DiseaseCoefficient * _objTeam.GetComponent <TeamObj>().soldiernumber));
                    // 英雄技能进入冷却
                    HeroSkillCoolDown();
                }
                break;

            default:
                break;
            }
        }