0
我正在研究Unity3D的MonoDevelop。我正在實施我的課程,但我得到一個錯誤,我無法弄清楚是什麼。我得到的問題是在我重寫抽象方法的標題處繼續並且已完成。問題是什麼?錯誤CS1585:成員修飾符'public'必須先於成員類型和名稱
namespace tool
{
public class TaskManager
{
public TaskManager()
{
}
}
public abstract class Task {
public bool isEvitable = true;
public abstract void proceed();
public abstract bool isFinished();
}
public class MoveTask : Task {
float speed;
Vector3 targetPosition;
GameObject movingObject;
private MoveTask(GameObject gameObject, float speed, Vector3 target) {
this.movingObject = gameObject;
this.speed = speed;
this.targetPosition = target;
}
@override
public void proceed() {
Vector3 objPos = movingObject.transform.position;
movingObject.transform.position = new Vector3 (Mathf.Lerp(objPos.x, targetPosition.x, speed),
Mathf.Lerp(objPos.y, targetPosition.y, speed),
Mathf.Lerp(objPos.z, targetPosition.z, speed));
}
@override
public bool isFinished() {
}
}
}
從未使用替代自己,但快速谷歌建議使用:公共覆蓋無效進行()...看來@override是Java,但使用的是C#,) – Tom