C sharp - Error en C#

 
Vista:

Error en C#

Publicado por Pol García Moreno (1 intervención) el 01/06/2023 20:19:22
Hola, soy nuevo en C# y estoy teniendo un error en un ejercicio de clase.

Error:

---------------------------------------------------------------------

System.MissingMethodException: 'Constructor on type 'TCGame.ForwardMovementComponent' not found.'

---------------------------------------------------------------------

Me sale en este código:

---------------------------------------------------------------------

public T AddComponent<T>(params object[] _componentArguments) where T : BaseComponent
{
Debug.Assert(GetComponent<T>() == null, "This prebab (name:" + m_PrefabName + ") already has a component of type " + typeof(T).ToString());
T component = (T)Activator.CreateInstance(typeof(T), _componentArguments);
m_Components.Add(component);
return component;
}

-----------------------------------------------------------------------

Y proviene de aquí:

-----------------------------------------------------------------------

using SFML.Graphics;
using SFML.System;
using System.Diagnostics;
using TCEngine;

namespace TCGame
{
// TODO (4): Create the ForwardMovementComponent
// - Although you can be creative, it should have at least these two memebers:
// - float m_Speed and Vector2f m_Forward
// - The main idea of this component is to move the actor in the m_Forward direction and the speed defined
// by the m_Speed member

public class ForwardMovementComponent : BaseComponent
{
private float m_Speed;
private Vector2f m_Forward;

public ForwardMovementComponent(float speed, Vector2f forward)
{
m_Speed = speed;
m_Forward = forward;
}

public override EComponentUpdateCategory GetUpdateCategory()
{
return EComponentUpdateCategory.Update;
}

public override void Update(float _dt)
{
base.Update(_dt);
TransformComponent transformPostion = this.Owner.GetComponent<TransformComponent>();

// Move the actor in the forward direction with the defined speed

transformPostion.Transform.Position += m_Forward * m_Speed * _dt;
}
public override object Clone()
{

return new ForwardMovementComponent(m_Speed, m_Forward);

}

}
}

---------------------------------------------------------------------

Si alguien quiere mas código o mas información no dudéis en preguntar :)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder