当前正在教自己如何正确使用可脚本化对象以及如何使它们与其他脚本进行通信。收到错误“找不到合适的方法来覆盖”。我做了自己的研究,这总是因为有错字或某些东西不完全相同。我在脚本中看不到任何一个问题。这太基础了,我已经看了20遍了。
public class DamageFormula : MonoBehaviour
{
public int Attack;
public int Power;
public int Damage;
// Start is called before the first frame update
public void Start()
{
Power = 0;
}
// Update is called once per frame
void Update()
{
CalculateDamage(Attack, Power);
}
void CalculateDamage(int Attack, int Power)
{
Damage = Attack * Power;
}
}
这是技能的基础课:
public abstract class BaseSkills : ScriptableObject
{
public int Power;
public abstract void Start(GameObject BattleManager);
}
这是第一个技能:问题是在公共场所无效时无效(Gameobject BattleManager)
[CreateAssetMenu(menuName = "Skills/HeadButt")]
public class HeadButt : ScriptableObject
{
public int Power = 30;
private DamageFormula damageFormula;
public override void Start(GameObject BattleManager)
{
damageFormula = BattleManager.GetComponent<DamageFormula>();
damageFormula.Start();
damageFormula.Power = Power;
}
}
出什么问题了?它想让我做什么?