Example #1
0
    public Actor CreatePureActor(ActorType type, int actorID, CSItemGuid guid, int staticID, bool isAddInMap = true)
    {
        Actor actor = null;

        m_actorMap.TryGetValue(actorID, out actor);
        if (actor != null)
        {
            return(actor);
        }
        switch (type)
        {
        case ActorType.enMain:
        {
            actor = new MainPlayer(type, actorID, staticID, guid);
            ConfigMainActor(actor);
        }
        break;

        case ActorType.enNPC:
        {
            actor = new NPC(type, actorID, staticID, guid);
            ConfigNPC(actor);
        }
        break;

        case ActorType.enPlayer:
        {
            actor = new Player(type, actorID, staticID, guid);
            ConfigPlayer(actor);
        }
        break;

        case ActorType.enFollow:
        {
            actor = new Player(type, actorID, staticID, guid);
            ConfigPlayer(actor);
            m_comradeActor = actor as Player;
        }
        break;

        case ActorType.enSwitch:
        {
            actor = new Player(type, actorID, staticID, guid);
            ConfigPlayer(actor);
            m_supportActor = actor as Player;
        }
        break;

//             case ActorType.enMold:
//             {
//                 actor = new SandTablePlayer(type, actorID);
//                 ConfigMainActor(actor);
//             }
        //break;
        case ActorType.enNPCTrap:
            actor = Trap.CreateTrapByType(actorID, staticID, guid);
            ConfigTrap(actor);
            break;

        default:
            break;
        }
        if (null != actor && isAddInMap)
        {
            m_actorMap.Add(actorID, actor);
            Actor delayActor;
            m_delayReleaseActorDict.TryGetValue(actorID, out delayActor);
            if (null != delayActor)
            {
                m_delayReleaseActorDict.Remove(actorID);
            }
        }
        return(actor);
    }