daily update on 20230329 by nitload youmu
This commit is contained in:
@@ -9,7 +9,7 @@ namespace StgSharp
|
||||
{
|
||||
internal ContainerNode<T> ID { get; }
|
||||
|
||||
internal void setID<T>(ContainerNode<T> id) where T : INode<T>;
|
||||
internal void setID(ContainerNode<T> id);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StgSharp
|
||||
public ContainerNode(T t)
|
||||
{
|
||||
_value = t;
|
||||
t.setID<T>(this);
|
||||
t.setID(this);
|
||||
}
|
||||
|
||||
public virtual ContainerNode<T> Previous
|
||||
|
||||
@@ -6,12 +6,12 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class LinkedList<T>:IEnumerable where T: INode<T>
|
||||
public class LinkedList<T>:IEnumerable,INode<LinkedList<T>> where T: INode<T>
|
||||
{
|
||||
internal readonly ContainerNode<T> _heading;
|
||||
internal ContainerNode<T> _first;
|
||||
internal ContainerNode<T> _tail;
|
||||
|
||||
private ContainerNode<LinkedList<T>> _id;
|
||||
private ContainerNode<T> _cache;
|
||||
|
||||
public LinkedList()
|
||||
@@ -35,6 +35,7 @@ namespace StgSharp
|
||||
set { _tail = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
ContainerNode<LinkedList<T>> INode<LinkedList<T>>.ID => _id;
|
||||
|
||||
public void Add(T t)
|
||||
{
|
||||
@@ -69,5 +70,17 @@ namespace StgSharp
|
||||
{
|
||||
return new LinkedListEnumrator<T>(this);
|
||||
}
|
||||
|
||||
void INode<LinkedList<T>>.setID(ContainerNode<LinkedList<T>> id)
|
||||
{
|
||||
if (_id == null)
|
||||
{
|
||||
throw new ArgumentException("Cannot set ID twice");
|
||||
}
|
||||
else
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-11
@@ -1,4 +1,5 @@
|
||||
using StgSharp;
|
||||
using Steamworks;
|
||||
using StgSharp;
|
||||
using StgSharp.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,25 +8,31 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Pool
|
||||
public class Pool:INode<Pool>
|
||||
{
|
||||
public LinkedList<Point> pointContainer;
|
||||
public LinkedList<IGeometry> geometryContainer;
|
||||
public LinkedList<Entity> _bulletContainer;
|
||||
public LinkedList<Entity> _awardContainer;
|
||||
public LinkedList<Entity> _enemyContainer;
|
||||
internal LinkedList<Point> pointContainer;
|
||||
internal LinkedList<IGeometry> geometryContainer;
|
||||
internal LinkedList<Entity> _bulletContainer;
|
||||
internal LinkedList<Entity> _awardContainer;
|
||||
internal LinkedList<Entity> _enemyContainer;
|
||||
|
||||
public Line leftBoader;
|
||||
public Line rightBoader;
|
||||
public Line topBoader;
|
||||
public Line bottomBoader;
|
||||
internal Line leftBoader;
|
||||
internal Line rightBoader;
|
||||
internal Line topBoader;
|
||||
internal Line bottomBoader;
|
||||
|
||||
internal Sensor<EntityPartical> Sensor;
|
||||
|
||||
private ContainerNode<Pool> _id;
|
||||
|
||||
|
||||
|
||||
public Pool()
|
||||
{
|
||||
}
|
||||
|
||||
ContainerNode<Pool> INode<Pool>.ID => _id;
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
foreach (Enemy e in _enemyContainer)
|
||||
@@ -34,6 +41,17 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
void INode<Pool>.setID(ContainerNode<Pool> id)
|
||||
{
|
||||
if (_id == default)
|
||||
{
|
||||
_id = id;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Cannot set ID twicee!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user