public void ImportFromLevel(DataMission mission) { this.mission = mission; extraTeamCount = mission.teamsId.Length; enemyTeams = new InstanceTeam[extraTeamCount]; friendTeams = new InstanceTeam[extraTeamCount]; for (int teamIndex = 0; teamIndex < extraTeamCount; ++teamIndex) { int teamId = mission.teamsId[teamIndex]; if (teamId != 0) { int memberCount = mission.GetMemberCount(teamIndex); int[] unitsId = mission.GetUnitsId(teamIndex); int[] unitsCount = mission.GetUnitsCount(teamIndex); InstanceTeam instanceTeam = new InstanceTeam(); for (int i = 0; i < memberCount; ++i) { int unitId = unitsId[i]; int unitCount = unitsCount[i]; int heroId = 0; float powerScale = mission.powerScale; if (unitId > 0 && unitCount > 0) { InstanceUnit instanceUnit = new InstanceUnit(false, heroId, unitId, unitCount, powerScale); instanceTeam.units[i] = instanceUnit; instanceUnit.Init(); } } if (teamId > 0) { enemyTeams[teamIndex] = instanceTeam; } else { friendTeams[teamIndex] = instanceTeam; } } } }
//-------------------------------------------------------------------------------------------------------------------------------- protected virtual void Z_OnUnitDead(InstanceZone zone, InstanceUnit obj, InstanceUnit attacker) { if (attacker != null && obj != null) { if (obj.Info.UType == DeepCore.GameData.Zone.UnitInfo.UnitType.TYPE_MONSTER && attacker is InstancePlayer) { //玩家. var player = attacker as InstancePlayer; //生成奖励信息. var notify = GetRoleBattleAward(zone, obj, player); if (notify != null) { //通知游戏服. NotifyLogicRoleAward(player.PlayerUUID, notify); } } } }
public void ImportFromPlayer() { InstancePlayerArmy playerArmy = InstancePlayer.instance.playerArmy; InstanceTeam instanceTeam = new InstanceTeam(); for (int i = 0; i < playerArmy.memberCount; ++i) { int unitId = playerArmy.unitId[i]; int unitCount = playerArmy.unitCount[i]; int heroId = playerArmy.heroId [i]; float powerScale = 1; if (unitId > 0 && unitCount > 0) { InstanceUnit instanceUnit = new InstanceUnit(true, heroId, unitId, unitCount, powerScale); instanceTeam.units[i] = instanceUnit; instanceUnit.Init(); } } myTeam = instanceTeam; }
/// <summary> /// 生成奖励. /// </summary> /// <param name="zone"></param> /// <param name="obj"></param> /// <param name="attacker"></param> /// <returns></returns> protected virtual RoleBattleAwardNotify GetRoleBattleAward(InstanceZone zone, InstanceUnit obj, InstancePlayer attacker) { RoleBattleAwardNotify ret = new RoleBattleAwardNotify(); ret.MonsterID = obj.Info.ID; ret.RoleID = attacker.PlayerUUID; return(ret); }
//交给子类去实现 protected virtual void Z_OnUnitGotInstanceItem(InstanceZone zone, InstanceUnit unit, InstanceItem item) { //TODO }