本文介绍了找不到合适的方法来覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我正在制作一个Terraria mod,我有一个问题。它说

So, i am making a Terraria mod, and i have a problem. It says

c:\Users\Павел\Documents\My Games\Terraria\ModLoader\Mod Sources\Megalia\Items\E-core.cs(38,30) : error CS0115: 'Megalia.NPCs.Boss.Ecore.Boss(ref string, ref string)': no suitable method found to override

。我不知道该怎么做。所以,这是代码:

. I don`t know what to do. So, this is the code:

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Megalia.NPCs.Boss
{
    public class Ecore : ModNPC
    {
        public override void SetDefaults()
        {
            npc.name = "E-core";
            npc.displayName = "E-core";
            npc.aiStyle = 5;  //5 is the flying AI
            npc.lifeMax = 100;   //boss life
            npc.damage = 20;  //boss damage
            npc.defense = 10;    //boss defense
            npc.knockBackResist = 0f;
            npc.width = 100;
            npc.height = 100;
            animationType = NPCID.DemonEye;   //this boss will behavior like the DemonEye
            Main.npcFrameCount[npc.type] = 2;    //boss frame/animation
            npc.value = Item.buyPrice(0, 40, 75, 45);
            npc.npcSlots = 1f;
            npc.boss = true;
            npc.lavaImmune = true;
            npc.noGravity = true;
            npc.noTileCollide = true;
            npc.soundHit = 8;
            npc.soundKilled = 14;
            npc.buffImmune[24] = true;
            music = MusicID.Boss2;
            npc.netAlways = true;
        }
        public override void headTexture(ref string headTexture, ref string EcoreMapIcon)
        {
            EcorePapIcon = "Megalia/NPCs/Boss/E-coreMapIcon"; //the boss head texture
        }
        public override void bossLifeScale(ref string name, ref int potionType)
        {
            potionType = ItemID.LesserHealingPotion;   //boss drops
            Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YourSword"));
        }
        public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
        {
            npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale);  //boss life scale in expertmode
            npc.damage = (int)(npc.damage * 0.6f);  //boss damage increase in expermode
        }
    }
}





我是什么尝试过:



我试图更改metod,但我没有得到任何东西,试图解决这个问题3个小时。请帮忙!



What I have tried:

I tried to change the metod, but i didn`t get anything, tried to fix this for 3 hours. Please help!

推荐答案

public override void headTexture(ref string headTexture, ref string EcoreMapIcon)

,错误是基类(及其继承层次结构)不包含具有该名称和参数列表的方法(称为签名) )可以在诸如你的派生类中重写。检查你的基类,看看你是否有错误的参数。

and the error is saying that the base class (and it's inheritance hierarchy) does not contain a method with that name and parameter list (called its signature) which can be overridden in derived classes such as yours. Check your base class and see if you have the wrong parameters for example.


这篇关于找不到合适的方法来覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 20:44