© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
9 replies
Sev

❔ does an interface go inside a generic parent class?

using Godot;
using System;

public class StateTemplate : Node
{
    public enum State {
        Null,
        Idle,
        Run,
        Fall,
        Jump,
        Dodge
    }
    [Export]
    private String animation_name;
    public Player Player;

    public void enter()
    {
        Player.AnimSprite.Play(animation_name);
    }
    public void exit()
    {}
    public int processInput(InputEvent @event)
    {
        return (int)State.Null;
    }
    public int doProcess(float delta)
    {
        return (int)State.Null;
    }
    public int processPhysics(float delta)
    {
        return (int)State.Null;
    }
}
using Godot;
using System;

public class StateTemplate : Node
{
    public enum State {
        Null,
        Idle,
        Run,
        Fall,
        Jump,
        Dodge
    }
    [Export]
    private String animation_name;
    public Player Player;

    public void enter()
    {
        Player.AnimSprite.Play(animation_name);
    }
    public void exit()
    {}
    public int processInput(InputEvent @event)
    {
        return (int)State.Null;
    }
    public int doProcess(float delta)
    {
        return (int)State.Null;
    }
    public int processPhysics(float delta)
    {
        return (int)State.Null;
    }
}

here is the parent class for my state machine, all states will have a
processInput()
processInput()
and
processPhysics
processPhysics
, do I create an
IState
IState
interface inside or outside of parent class? I ask because I am translating this from another language and I think this is a pseudo interface
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Nested classes in C# with parent being a generic class
C#CC# / help
13mo ago
✅ a class implementing a generic interface with more than one interface as one generic type argument
C#CC# / help
3y ago
Casting class with generic variable to the same class with an interface that the generic implements
C#CC# / help
2y ago