daily update on 20230320 by nitload youmu

This commit is contained in:
Nitload
2023-03-20 01:45:49 +08:00
parent 167e33a3dd
commit db2ca36fd7
100 changed files with 1211 additions and 746 deletions
@@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Entities
{
internal class CollisionPartical
{
}
}
+11
View File
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Entities
{
public class Enemy : Entity
{
}
}
+71
View File
@@ -0,0 +1,71 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class Entity:INode<Entity>
{
internal vec2d _pos;
internal IGeometry _collisionBox;
internal Sensor<IGeometry> _collisionSensor;
internal ContainerNode<Entity> _id;
public IGeometry CollisionBox
{
get { return _collisionBox; }
set { _collisionBox = value; }
}
/// <summary>
/// A sensor used for cheking out if a bullet hit a player or something else
/// </summary>
public Sensor<IGeometry> CollisionSensor
{
get { return _collisionSensor; }
set { _collisionSensor = value; }
}
public string Texture { get; set; }
/// <summary>
/// A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
/// </summary>
public vec2d Location { get; }
/// <summary>
/// X position of an enenmy entity
/// </summary>
public float X { get; set; }
/// <summary>
/// Y position of an enemy entity
/// </summary>
public float Y { get; set; }
ContainerNode<Entity> INode<Entity>.ID
{
get { return _id; }
}
public void SetLocation(Point p)
{
}
void INode<Entity>.setID<T>(ContainerNode<T> id)
{
if (id == null)
{
_id = id as ContainerNode<Entity>;
}
else
{
throw new ArgumentException("Cannot set id twice!");
}
}
}
}
-20
View File
@@ -1,20 +0,0 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public interface IEntity:INode
{
public IGeometry CollisionBox { get; set; }
public Sensor CollisionSensor { get; set; }
public string Texture { get; set; }
public Vec2D Location { get; }
public void SetLocation(Point p);
}
}
+1 -36
View File
@@ -5,43 +5,8 @@ using System.Text;
namespace StgSharp
{
public class Partical : IEntity
public class Partical : Entity
{
internal IGeometry _collisionBox;
internal Sensor _collisionSensor;
internal string _texture;
internal Vec2D _position;
IGeometry IEntity.CollisionBox
{
get { return _collisionBox; }
set { _collisionBox = value; }
}
Sensor IEntity.CollisionSensor
{
get { return _collisionSensor; }
set { _collisionSensor = value; }
}
string IEntity.Texture
{
get { return _texture; }
set { _texture = value; }
}
Vec2D IEntity.Location
{
get { return _position; }
}
ContainerNode<INode> INode.ID => throw new NotImplementedException();
void INode.setID<T>(ContainerNode<T> id)
{
throw new NotImplementedException();
}
void IEntity.SetLocation(StgSharp.Point p)
{
this._position = p._position;
}
}
}
+1 -51
View File
@@ -5,58 +5,8 @@ using System.Text;
namespace StgSharp
{
public class Player : IEntity
public class Player : Entity
{
internal IGeometry _collisionBox;
internal Sensor _collisionSensor;
internal string _texture;
internal Vec2D _position;
private ContainerNode<INode> _id;
IGeometry IEntity.CollisionBox
{
get { return this._collisionBox; }
set { this._collisionBox = value; }
}
Sensor IEntity.CollisionSensor
{
get { return this._collisionSensor; }
set { this._collisionSensor = value; }
}
string IEntity.Texture
{
get { return this._texture; }
set { this._texture = value; }
}
Vec2D IEntity.Location
{
get { return this._position; }
}
ContainerNode<INode> INode.ID
{
get { return _id; }
}
public void SetLocation(Point p)
{
throw new NotImplementedException();
}
void INode.setID<T>(ContainerNode<T> id)
{
if (id == null)
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentException("Cannot set id twice!");
}
}
}
}