So what I'm doing is messing around with an existing quad tree example. My hopes is I'll be able to adapt it for use on my server (I HAVE looked through the example and understand it fairly well so far.. it's not that complicated, just like having something working with as a template to start)
The problem I'm having is this....
The example I have uses interfaces to pull x/y dimensions for the objects being stored in the quad (allows for collision detection simply using xna framework to determine what needs to be spawned/removed)... yet for some reason I can't figure out for the life of me how to go about doing this.
Sample code;
Code:
public interface HasRect
{
Rectangle Rect { get; }
}
public class Quad<T> where T : HasRect
{....
So to add anything to this quad obviously, I need to add this to my Entity information.
Code:
public class GameClient : Calculation.HasRect
{....
Doing public Rectangle Rect = new Rectangle(X, Y, Height, Width); obviously works but does not allow me to do anything because it's not implementing the interface...
Some generic examples of things I've tried (I'm well aware they are not the right way.. just listing some things I've done..
HasRect(Rect); (where rect is a defined rectangle already created)
HasRect A = new HasRect(); //cannot create instance of the abstract class or interface blablabla
asRect A;
A.Rect = new Rectangle(1,2,3 ,4);
//cannot be assigned to, it's read only... I can add set; to the code and it will then tell me that A is an unassigned local variable obviously
Forget what else I tried... Basically I've tried every way I know to setup values and interface seems to just keep kicking my ass... I KNOW it's something simple but I can't seem to find any valid information on google about this type of thing. It's all calling functions and stuff through interfaces and inheritance.






