The previous article we saw the "furnace Stone Legend" core memory card data, today, we continue to explore the card & skill.
Basic classes through previous analysis, cards & skills involve several class systems: Entity. Actor. Card. Spell, it is very confusing, especially the former two. Here the basic positioning of these classes is slightly arbitrary:
- Entity is mainly used to do network data synchronization;
- The actor mainly handles the control of the client's render object, which is mounted as a component on the resource object;
- Spell is the script that the skill prefab mounts.
- Card is a script that is mounted on a prefab. In the implementation of the central position to deal with the first 3 contacts.
Entity
- Entity is created through network data, mainly Network.PacketID.POWER_HISTORY this message.
See gamestate.createnewentities () function. Because entity is not a monobehavior derived class. So is new out, and then added to the GameState management (Gamestate.addentity ()), the network came from the entity data is mainly tags (each tag is a name->value pair). Then call Entity.initentity ();
Actor
- Actor is also a resource, loaded through Assetloader.loadactor ();
- corresponding to Assetfamily.actor.
- The corresponding resource bundle is "actor?". Unity3d ", in the package for the Gameobject;
- The actor's loading entry is in: Card.determineactorthentransitiontozone ()
Spell
- The loading entrance of the spell is at Entity.processcarddefassetrequest ()
Card
- Called Entity.initcard () in initentity, it does the job of simply creating an empty gameobject, and then using addcomponent to add the card.
- The real card prefab is loaded in Entity.loadcard (), which is called in gamestate.onshowentity () when processing powertask.
- The detailed loading is done through Defloader.loadcarddef (). It internally calls Assetloader.loadcardprefab () for resource onboarding.
Card & Skill loading process entity creation, as well as card, spell loading, are triggered by the network message, the whole process is more complex, mainly there are very many asynchronous callbacks. More difficult to describe in words. Please see:
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvtmvpbdne/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
"The Legend of the Furnace Stone" Architectural Design Appreciation (6): Card & Organizational ability when executing data