daily update on 20230322 by nitload youmu, new geometry structure rewritten 70%

This commit is contained in:
Nitload
2023-03-22 20:32:17 +08:00
parent db2ca36fd7
commit eedab82f6e
66 changed files with 1382 additions and 785 deletions
+17
View File
@@ -6,6 +6,23 @@ namespace StgSharp.Entities
{
public class Enemy : Entity
{
public bool _selectalbe;
public Launcher<EntityPartical> _awardLauncher;
public Launcher<EntityPartical> _commonBulletLauncher;
public Launcher<EntityPartical> _dieBulletLauncher;
internal void InternalDieOperation(Pool home)
{
_dieBulletLauncher.Launch(Control.TimeLine.tickCounter, home._bulletContainer);
_awardLauncher.Launch(Control.TimeLine.tickCounter, home._awardContainer);
this._id.Remove();
}
}
}
+12 -3
View File
@@ -7,11 +7,14 @@ namespace StgSharp
{
public class Entity:INode<Entity>
{
internal vec2d _pos;
internal Point _pos;
internal IGeometry _collisionBox;
internal Sensor<IGeometry> _collisionSensor;
internal ContainerNode<Entity> _id;
internal String _texture;
internal Point _position;
internal Point _basePoint;
internal GetLocationHandler _movHandler;
public IGeometry CollisionBox
{
@@ -53,7 +56,7 @@ namespace StgSharp
public void SetLocation(Point p)
{
_pos = p;
}
void INode<Entity>.setID<T>(ContainerNode<T> id)
@@ -67,5 +70,11 @@ namespace StgSharp
throw new ArgumentException("Cannot set id twice!");
}
}
public void OnRender()
{
_position._position = _movHandler.Invoke(_basePoint._position, Control.TimeLine.tickCounter);
}
}
}
@@ -4,7 +4,8 @@ using System.Text;
namespace StgSharp.Entities
{
internal class CollisionPartical
public class EntityPartical : Entity
{
}
}
+39 -6
View File
@@ -1,17 +1,50 @@
using System;
using StgSharp.Entities;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class Launcher
public class Launcher<T>:INode<Launcher<T>> where T : Entity
{
internal Partical _bullet;
/*
*用于发射其他的实体,主要是子弹 和 掉落物
*/
public Partical Bullet
internal vec2d _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
private ContainerNode<Launcher<T>> _id;
internal Counter<int> _internalParameter; //发射器的内部计时器
internal EntityPartical _bulletSample; //发射的子弹类型
internal uint[] launchtick; //发射子弹的内部计时
public EntityPartical Bullet
{
get { return _bullet; }
set { _bullet = value; }
get { return _bulletSample; }
set { _bulletSample = value; }
}
internal void Launch(Counter<uint> outerTickCounter, LinkedList<Entity> container)
{
}
ContainerNode<Launcher<T>> INode<Launcher<T>>.ID
{
get { return _id; }
}
void INode<Launcher<T>>.setID<T1>(ContainerNode<T1> id)
{
if (_id == default(ContainerNode<Launcher<T>>))
{
throw new ArgumentException();
}
else
{
_id = id as ContainerNode<Launcher<T>>;
}
}
}
}
+9
View File
@@ -1,12 +1,21 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp
{
public class Player : Entity
{
internal float _velocity;
public float Velocity
{
get { return _velocity; }
}
}
}