Autoload() public method

public Autoload ( string &name, string &texture, string &altTextures ) : bool
name string
texture string
altTextures string
return bool
Beispiel #1
0
        private void AutoloadNPC(Type type)
        {
            ModNPC npc = (ModNPC)Activator.CreateInstance(type);

            npc.mod = this;
            string name           = type.Name;
            string texture        = (type.Namespace + "." + type.Name).Replace('.', '/');
            string defaultTexture = texture;

            if (npc.Autoload(ref name, ref texture))
            {
                AddNPC(name, npc, texture);
                string headTexture     = defaultTexture + "_Head";
                string bossHeadTexture = headTexture + "_Boss";
                npc.AutoloadHead(ref headTexture, ref bossHeadTexture);
                if (ModLoader.TextureExists(headTexture))
                {
                    AddNPCHeadTexture(npc.npc.type, headTexture);
                }
                if (ModLoader.TextureExists(bossHeadTexture))
                {
                    AddBossHeadTexture(bossHeadTexture);
                    NPCHeadLoader.npcToBossHead[npc.npc.type] = NPCHeadLoader.bossHeads[bossHeadTexture];
                }
            }
        }
Beispiel #2
0
        private void AutoloadNPC(Type type)
        {
            ModNPC npc = (ModNPC)Activator.CreateInstance(type);

            npc.mod = this;
            string name = type.Name;

            if (npc.Autoload(ref name))
            {
                AddNPC(name, npc);
                var autoloadHead = type.GetAttribute <AutoloadHead>();
                if (autoloadHead != null)
                {
                    string headTexture = npc.HeadTexture;
                    AddNPCHeadTexture(npc.npc.type, headTexture);
                }
                var autoloadBossHead = type.GetAttribute <AutoloadBossHead>();
                if (autoloadBossHead != null)
                {
                    string headTexture = npc.BossHeadTexture;
                    AddBossHeadTexture(headTexture, npc.npc.type);
                }
            }
        }