/// <summary> /// 释放队伍,本队锁定,本队英雄重新带队 /// </summary> /// <param name="_team">要释放队伍的装载型队伍</param> public void GoOutTeam(TeamObj _team) { if (_team && _team.soldiertype == WorldObj.SoldierType.Tank && !_team.locking) { cityController.BuildNewTeam(_team.nationality, _team.soldiernumber, _team.hero, _team.driversoldiertype, null, _team.transform.position); _team.UpdateTeamHero(""); _team.UpdateSoldierNumber(1000); _team.UpdateSliderMaxValue(1000); _team.UpdateSliderValue(1000); _team.UpdateDriverSoldierType(WorldObj.SoldierType.none); photonView.RPC("LockUnLockBuildingTeamRPC", PhotonTargets.All, newTeams.IndexOf(_team.gameObject), true); //如果该队伍是空军,则减低位置 if (_team.features.Contains(WorldObj.TeamFeature.AirForce)) { StopCoroutine(_team.coroutineFollow); StopCoroutine(_team.coroutineTurnToTarget); _team.transform.position -= new Vector3(0f, 2f, 0f); } } }
/// <summary> /// 入队,本队伍解散,士兵归装载型队伍 /// </summary> /// <param name="_team">要进入的装载型队伍</param> public void GoInTeam(TeamObj _team) { //如果是己方队伍并且是被建造中未解锁的装载型队伍,则入队(Tank队伍不能入队) if (_team.nationality == teamObj.nationality && _team.soldiertype == WorldObj.SoldierType.Tank && _team.locking && teamObj.soldiertype != WorldObj.SoldierType.Tank) { _team.UpdateTeamHero(teamObj.hero); _team.UpdateSoldierNumber(teamObj.soldiernumber); _team.UpdateSliderMaxValue(teamObj.soldiernumber); _team.UpdateSliderValue(teamObj.soldiernumber); _team.UpdateDriverSoldierType(teamObj.soldiertype); teamObj.DestroySelf(0f); //同步解锁被造队伍模型 photonView.RPC("LockUnLockBuildingTeamRPC", PhotonTargets.All, newTeams.IndexOf(_team.gameObject), false); //如果该队伍是空军,则提高位置 if (_team.features.Contains(WorldObj.TeamFeature.AirForce)) { _team.transform.position += new Vector3(0f, 2f, 0f); } } }
/// <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; } }