コード例 #1
0
    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;
                }
            }
        }
    }
コード例 #2
0
        //--------------------------------------------------------------------------------------------------------------------------------


        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);
                    }
                }
            }
        }
コード例 #3
0
    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;
    }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
 //交给子类去实现
 protected virtual void Z_OnUnitGotInstanceItem(InstanceZone zone, InstanceUnit unit, InstanceItem item)
 {
     //TODO
 }