Daily update on 20230413 by nitload youmu

This commit is contained in:
Nitload
2023-04-13 01:37:16 +08:00
parent 2e1b0fe351
commit de494a35e6
45 changed files with 294 additions and 206 deletions
+40
View File
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Entities
{
public class EliteEnemy:IEntity
{
public bool _selectalbe;
internal Launcher<EntityPartical> _awardLauncher;
internal LinkedList< Launcher<EntityPartical>> _commonBulletLauncher;
internal Launcher<EntityPartical> _dieBulletLauncher;
public Launcher<EntityPartical> AwardLauncher { get; set; }
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher { get; set; }
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
internal void InternalDieOperation(Pool home)
{
_dieBulletLauncher.Launch(Control.GameTimeLine.tickCounter, home._bulletContainer);
_awardLauncher.Launch(Control.GameTimeLine.tickCounter, home._awardContainer);
this._id.Remove();
}
internal override void OnRenderFrame()
{
this.OnUpdate();
foreach (Launcher<EntityPartical> launcher in CommonBulletLauncher)
{
launcher.Launch(Control.GameTimeLine.tickCounter, Control.GameTimeLine._currentPool._bulletContainer);
}
this.OnRender();
}
public virtual void OnRender() => new NotImplementedException();
public virtual void OnUpdate() => new NotImplementedException();
}
}
+15 -7
View File
@@ -4,16 +4,17 @@ using System.Text;
namespace StgSharp.Entities
{
public class Enemy : Entity
public class Enemy : IEntity
{
public bool _selectalbe;
public Launcher<EntityPartical> _awardLauncher;
public Launcher<EntityPartical> _commonBulletLauncher;
public Launcher<EntityPartical> _dieBulletLauncher;
internal Launcher<EntityPartical> _awardLauncher;
internal Launcher<EntityPartical> _commonBulletLauncher;
internal Launcher<EntityPartical> _dieBulletLauncher;
public Launcher<EntityPartical> AwardLauncher { get; set; }
public Launcher<EntityPartical> CommonBulletLauncher { get; set; }
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
internal void InternalDieOperation(Pool home)
{
@@ -22,7 +23,14 @@ namespace StgSharp.Entities
this._id.Remove();
}
public override void OnRender()
{
throw new NotImplementedException();
}
public override void OnUpdate()
{
throw new NotImplementedException();
}
}
}
@@ -4,8 +4,8 @@ using System.Text;
namespace StgSharp.Entities
{
public class EntityPartical : Entity
public abstract class EntityPartical : IEntity
{
}
}
@@ -6,23 +6,22 @@ using System.Text;
namespace StgSharp
{
public class Entity:INode<Entity>
public abstract class IEntity:INode<IEntity>
{
internal Point _pos;
internal IGeometry _collisionBox;
internal LinkedList<IGeometry> _collisionBox;
internal Sensor<IGeometry> _collisionSensor;
internal ContainerNode<Entity> _id;
internal String _texture;
internal string _texture;
internal Point _position;
internal Point _basePoint;
internal GetLocationHandler _movHandler;
protected uint _bornTick;
public IGeometry CollisionBox
public LinkedList<IGeometry> CollisionBox
{
get { return _collisionBox; }
set { _collisionBox = value; }
}
/// <summary>
/// A sensor used for cheking out if a bullet hit a player or something else
@@ -50,32 +49,12 @@ namespace StgSharp
/// </summary>
public float Y { get; set; }
ContainerNode<Entity> INode<Entity>.ID
{
get { return _id; }
}
public void SetLocation(Point p)
{
_pos = p;
}
void INode<Entity>.setID(ContainerNode<Entity> id)
{
if (id == null)
{
_id = id;
}
else
{
throw new ArgumentException("Cannot set id twice!");
}
}
public void OnRender()
{
_position._position = _movHandler.Invoke(_basePoint._position, Control.GameTimeLine.tickCounter);
}
internal abstract void OnRenderFrame();
}
}
+3 -19
View File
@@ -6,14 +6,13 @@ using System.Text;
namespace StgSharp
{
public class Launcher<T>:INode<Launcher<T>> where T : Entity
public class Launcher<T>:INode<Launcher<T>> where T : IEntity
{
/*
*用于发射其他的实体,主要是子弹 和 掉落物
*/
internal vec2d _center; //发射器的参考位置,运动轨迹的方程应当基于这个参考点构建
private ContainerNode<Launcher<T>> _id;
internal Counter<int> _internalParameter; //发射器的内部计时器
internal EntityPartical _bulletSample; //发射的子弹类型
internal uint[] launchtick; //发射子弹的内部计时
@@ -24,27 +23,12 @@ namespace StgSharp
set { _bulletSample = value; }
}
internal void Launch(Counter<uint> outerTickCounter, LinkedList<Entity> container)
internal virtual void Launch(Counter<uint> outerTickCounter, LinkedList<IEntity> container)
{
}
ContainerNode<Launcher<T>> INode<Launcher<T>>.ID
{
get { return _id; }
}
void INode<Launcher<T>>.setID(ContainerNode<Launcher<T>> id)
{
if (_id == default(ContainerNode<Launcher<T>>))
{
throw new ArgumentException();
}
else
{
_id = id;
}
}
}
}
+9 -1
View File
@@ -5,8 +5,16 @@ using System.Text;
namespace StgSharp
{
public class Partical : Entity
public class Partical : IEntity
{
public override void OnRender()
{
throw new NotImplementedException();
}
public override void OnUpdate()
{
throw new NotImplementedException();
}
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ using System.Text;
namespace StgSharp
{
public class Player : Entity
public abstract class Player : IEntity
{
internal float _velocity;