Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
bce8370
Fix collisions not being detected when one item is inactive
nibsbin Mar 22, 2016
ecadb84
Add onSetup and onInitialize events
nibsbin Mar 23, 2016
1a87759
Ignore collision of a destroyed immovable agent
GCat Mar 24, 2016
96faa81
Update CollisionPair.cs
GCat Mar 24, 2016
daf58e9
Merge pull request #69 from GCat/Develop
nibsbin Mar 25, 2016
db8eb88
Fix HeightSet _bonusHeight being serialized as normal integer. Clean …
nibsbin Mar 29, 2016
96e24e1
Merge remote-tracking branch 'origin/Develop' into Develop
nibsbin Mar 29, 2016
3387e8b
Sync
nibsbin Mar 29, 2016
7b9d162
Implement positional projectiles
nibsbin Mar 29, 2016
c95248b
Add Speed and VisualArc settings to Positional projectiles
nibsbin Mar 30, 2016
f6d1fdd
Add special attack animation capacity to default LSAnimator
nibsbin Mar 30, 2016
abb1bed
Implement cooldown; Refactor
nibsbin Mar 31, 2016
7b283df
Implement long GetRandom
nibsbin Mar 31, 2016
396511b
Add all agents of type
nibsbin Apr 1, 2016
259dc90
Update
nibsbin Apr 1, 2016
77916aa
Fix circle-box collision resolution
nibsbin Apr 1, 2016
0b3005b
Implement removal of grid mapping when DynamicBlocker is deactivated
nibsbin Apr 4, 2016
afd0fc5
Refactor
nibsbin Apr 4, 2016
aa72e81
Fix multi-edit bug
nibsbin Apr 5, 2016
2a7d343
Add automated selection sizes
nibsbin Apr 5, 2016
e5c6c60
Clean up serialization of LSAgent
nibsbin Apr 5, 2016
2483c76
Tweak and add visual ring size offset
nibsbin Apr 5, 2016
86dbf08
public access for set Speed
GladFox Apr 5, 2016
2e9859e
Refactor
nibsbin Apr 6, 2016
9160491
Merge remote-tracking branch 'origin/Develop' into Develop
nibsbin Apr 6, 2016
5df9c5c
Force Immovable on all shapes except circle
nibsbin Apr 6, 2016
1d6083f
Fix circle collisions on AABox corners
nibsbin Apr 6, 2016
1005b7e
Fix side collisions on AABox
nibsbin Apr 6, 2016
f750eeb
Add onDeactivate event to agents
nibsbin Apr 6, 2016
5ae4e82
Disallow multiple HeightSets
nibsbin Apr 7, 2016
a11fe68
Fix onDeactivate not being called.
nibsbin Apr 7, 2016
1ab5436
Expose Size of selection ring
nibsbin Apr 7, 2016
5094f5f
Fix Scan user taking damage
nibsbin Apr 8, 2016
2590027
Fix modulus by 0 when generating random number.
nibsbin Apr 8, 2016
f93e2b3
Remove .DS_Store files
nibsbin Apr 11, 2016
ea135b3
Update gitignore
nibsbin Apr 11, 2016
cd361fb
Add adjustable priority increase
nibsbin Apr 11, 2016
c47c314
Refactor
nibsbin Apr 11, 2016
abf5adc
Add default value for Scan.IncreasePriority
nibsbin Apr 11, 2016
ac0a2ff
Test
nibsbin Apr 11, 2016
3949f09
Fix VectorRotation inspector; Refactor
nibsbin Apr 12, 2016
be1acdc
Refactor
nibsbin Apr 12, 2016
3149da5
Remove Application.targetFrameRate
nibsbin Apr 12, 2016
15f2feb
Fixed timed projectiles with standard Scan
nibsbin Apr 12, 2016
446fc76
Apply rotation to projectile effects
nibsbin Apr 13, 2016
0a54fda
Fix first rotation update
nibsbin Apr 13, 2016
b9bc7d7
Fix animation initialization order
nibsbin Apr 13, 2016
3166ab5
Refactor; Add Tint for selection ring
nibsbin Apr 13, 2016
a42e082
Increase space between buildings; Fix SquareSize
nibsbin Apr 13, 2016
1e4c8f5
Refactor
nibsbin Apr 13, 2016
c3137e6
Add handling for DataCode
nibsbin Apr 13, 2016
6e75079
Fix linear projectile height movement
nibsbin Apr 14, 2016
6e482df
Implement lasting projectiles
nibsbin Apr 15, 2016
eada890
HeightPosChanged never false; is needed HeightPosChanged or enough Po…
GladFox Apr 17, 2016
2b050be
Fix friendly targeting
nibsbin Apr 18, 2016
4db6859
Merge remote-tracking branch 'origin/Develop' into Develop
nibsbin Apr 18, 2016
fb19926
Fix delay value
nibsbin Apr 18, 2016
7d6772a
Remove debug log
nibsbin Apr 18, 2016
dfeb811
Fix negative damage (healing) healing above max health
nibsbin Apr 18, 2016
9e7e9f7
Fix syntax error
nibsbin Apr 18, 2016
5b12271
Fix targeting conditionals
nibsbin Apr 18, 2016
3e86554
Fix Move not turning optimally
nibsbin Apr 18, 2016
36ed93b
Expose Unbuild
nibsbin Apr 19, 2016
b0d9490
Fix UnpassableLarge
nibsbin Apr 19, 2016
c5e03ab
Add GetAbility with name
nibsbin Apr 19, 2016
66015ad
Fix GetAbility (string)
nibsbin Apr 19, 2016
2c72a94
Refactor projectiles
nibsbin Apr 20, 2016
af3ed3b
Implement use of RotationTransform and PositionalTransform
nibsbin Apr 20, 2016
fe4a591
Fix AttachEndEffectToTarget
nibsbin Apr 20, 2016
d6ead26
Add Injector; Refactor
nibsbin Apr 20, 2016
9705838
Add GetProperty
nibsbin Apr 20, 2016
e4c414a
Fix Injector saving
nibsbin Apr 21, 2016
3f39406
Add AgentValid
nibsbin Apr 21, 2016
ce93f83
Add Injector.Get/SetVector3
nibsbin Apr 21, 2016
ca3ade0
remove unused variable
GladFox Apr 22, 2016
67eccad
Fix UnpassableLarge index out of range
nibsbin Apr 22, 2016
75854b8
Merge remote-tracking branch 'origin/Develop' into Develop
nibsbin Apr 22, 2016
a759452
Refactor
nibsbin Apr 22, 2016
17ee9a3
Refactor and remove PlatformType
nibsbin Apr 22, 2016
afd131a
Optimize AgentValid
nibsbin Apr 22, 2016
23f7442
Add OnStartWindup
nibsbin Apr 22, 2016
378c90d
Add LastCommand
nibsbin Apr 25, 2016
0488c39
Fix null reference
nibsbin Apr 25, 2016
3a23b6b
Refactor
nibsbin Apr 25, 2016
df3c607
Refactor
nibsbin Apr 25, 2016
8a21820
Fix functions not being called
nibsbin Apr 26, 2016
184f2c2
clear instance
GladFox Apr 26, 2016
2f59078
Merge branch 'Develop' of https://github.com/SnpM/LockstepFramework i…
GladFox Apr 26, 2016
f8f9c67
Fix invalid quaternions for timed projectiles
nibsbin Apr 27, 2016
439fb41
Merge remote-tracking branch 'origin/Develop' into Develop
nibsbin Apr 27, 2016
233a5fb
Fix projectile position initialization
nibsbin Apr 27, 2016
ef3ddb3
Add SpecialEngaging and refactor Scan
nibsbin Apr 28, 2016
f768e10
Add setter for Forward
nibsbin Apr 29, 2016
407bf1b
Big changes to GameManager and InterfacingHelper!
nibsbin May 3, 2016
bee0f4c
asdf
nibsbin May 3, 2016
3423692
Add LockstepManager.Reset ()
nibsbin May 3, 2016
3bd5390
Refactor for ChangeController
nibsbin May 3, 2016
e9bb1ae
Fix ChangeController
nibsbin May 3, 2016
6af0c83
Fix FixedNumber multi-editing
nibsbin May 3, 2016
8ebae46
Fix bugs
nibsbin May 4, 2016
7f351db
HitFX rotation flag
GladFox May 10, 2016
dcdc015
Rotate HitFX
GladFox May 10, 2016
026c1a3
Fixing example scene with latest Develop
doctorpangloss Jun 10, 2016
65fbcc6
Fix effects for example
doctorpangloss Jun 10, 2016
802b90c
Deleting spurious cube in ExampleScene
doctorpangloss Jun 10, 2016
8552c50
Merge pull request #71 from hiddenswitch/Develop
nibsbin Jun 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*.userprefs
*.pidb
*.booproj
*.DS_Store

# Unity3D generated meta files
*.pidb.meta
Expand Down
Binary file removed Core/.DS_Store
Binary file not shown.
Binary file removed Core/Game/.DS_Store
Binary file not shown.
Binary file removed Core/Game/Abilities/.DS_Store
Binary file not shown.
9 changes: 7 additions & 2 deletions Core/Game/Abilities/Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Lockstep
{
public abstract class Ability : CerealBehaviour
public abstract class Ability : MonoBehaviour//CerealBehaviour
{
private bool isCasting;

Expand Down Expand Up @@ -75,7 +75,6 @@ internal void Setup(LSAgent agent, int id)
mainType = mainType.BaseType;
}
Data = AbilityDataItem.FindInterfacer(mainType);

if (Data == null)
{
throw new System.ArgumentException("The Ability of type " + mainType + " has not been registered in database");
Expand Down Expand Up @@ -123,13 +122,19 @@ protected virtual void OnInitialize()

internal void Simulate()
{
TemplateSimulate ();

OnSimulate();
if (isCasting)
{
OnCast();
}
}

protected virtual void TemplateSimulate () {

}

protected virtual void OnSimulate()
{
}
Expand Down
10 changes: 10 additions & 0 deletions Core/Game/Abilities/AbilityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ public void Deactivate() {
Abilitys[k].Deactivate();
}
}
public Ability GetAbility (string name) {
for (var k = 0; k < Abilitys.Length; k++) {
var ability = Abilitys[k];
if (ability.Data != null)
if (ability.Data.Name == name) {
return ability;
}
}
return null;
}
public T GetAbility<T>() where T : Ability {
for (var k = 0; k < Abilitys.Length; k++) {
var ability = Abilitys[k] as T;
Expand Down
18 changes: 17 additions & 1 deletion Core/Game/Abilities/ActiveAbility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,31 @@
namespace Lockstep {
public abstract class ActiveAbility : Ability {

[SerializeField,FrameCount]
protected int _cooldown;
public int Cooldown {get {return _cooldown;}}

public ushort ListenInput {get; private set;}

private int _heat;
public int Heat {get {return _heat;}private set {_heat = value;}}

protected sealed override void TemplateSetup ()
{
ListenInput = Data.ListenInputID;
}

public void Execute(Command com) {
OnExecute(com);

if (Heat <= 0) {
OnExecute(com);
Heat = Cooldown;
}
}

protected override void TemplateSimulate()
{
Heat--;
}

protected virtual void OnExecute(Command com) {}
Expand Down
Binary file removed Core/Game/Abilities/Essential/.DS_Store
Binary file not shown.
149 changes: 94 additions & 55 deletions Core/Game/Abilities/Essential/Health.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,120 @@

namespace Lockstep
{
public class Health : Ability
{
[SerializeField, FixedNumber]
private long _maxHealth = FixedMath.One * 100;
public class Health : Ability
{
[SerializeField, FixedNumber]
private long _maxHealth = FixedMath.One * 100;

public long MaxHealth
{
get { return _maxHealth; }
set { _maxHealth = value; }
}
public long MaxHealth
{
get { return _maxHealth; }
}

public long DamageMultiplier
{
get;
set;
}

public event Action onHealthChange;
private long _healthAmount;
public long HealthAmount {

public bool CanLose {
get {
return HealthAmount > 0;
}
}
public bool CanGain {
get {
return _healthAmount;
return HealthAmount < MaxHealth;
}
}

[SerializeField, FixedNumber]
private long _currentHealth;

public long HealthAmount
{
get
{
return _currentHealth;
}
set {
_healthAmount = value;
set
{
_currentHealth = value;
if (onHealthChange != null)
onHealthChange ();
onHealthChange();
}

}

protected override void OnSetup()
{
}

protected override void OnInitialize()
{
HealthAmount = MaxHealth;
OnTakeProjectile = null;
}

public void TakeProjectile(LSProjectile projectile)
{
if (Agent.IsActive && HealthAmount >= 0) {
if (OnTakeProjectile .IsNotNull ())
{
OnTakeProjectile (projectile);
}
TakeRawDamage (projectile.CheckExclusiveDamage (Agent.Tag));
}
}

public void TakeRawDamage (long damage) {
HealthAmount -= damage;
// don't let the health go below zero
if (HealthAmount <= 0) {
HealthAmount = 0;

if (HealthAmount <= 0) {
Die ();
return;
}
}
protected override void OnSetup()
{
}

protected override void OnInitialize()
{
HealthAmount = MaxHealth;
OnTakeProjectile = null;
}

public void TakeProjectile(LSProjectile projectile)
{
if (Agent.IsActive && HealthAmount >= 0)
{
if (OnTakeProjectile.IsNotNull())
{
OnTakeProjectile(projectile);
}
TakeDamage(projectile.CheckExclusiveDamage(Agent.Tag));
}
}

public void TakeDamage(long damage)
{
if (damage >= 0)
{
damage.Mul(DamageMultiplier);
HealthAmount -= damage;
// don't let the health go below zero
if (HealthAmount <= 0)
{
HealthAmount = 0;

if (HealthAmount <= 0)
{
Die();
return;
}
}
}
else {
HealthAmount -= damage;
if (HealthAmount >= this.MaxHealth) {
HealthAmount = MaxHealth;
}
}

}
}

public void Die () {
public void Die()
{
AgentController.DestroyAgent(Agent);
if (Agent.Animator.IsNotNull ()) {
if (Agent.Animator.IsNotNull())
{
Agent.SetState(AnimState.Dying);
Agent.Animator.Visualize();
}
}

protected override void OnDeactivate() {
OnTakeProjectile = null;
}
protected override void OnDeactivate()
{
OnTakeProjectile = null;
}

public event Action<LSProjectile> OnTakeProjectile;

public event Action<LSProjectile> OnTakeProjectile;
public int shieldIndex {get; set;}
public int shieldIndex { get; set; }


}
Expand Down
4 changes: 3 additions & 1 deletion Core/Game/Abilities/Essential/HeightSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@

namespace Lockstep
{
[UnityEngine.DisallowMultipleComponent]
public class HeightSet : Ability
{
[SerializeField]
private int _mapIndex;

public int MapIndex { get { return _mapIndex; } }

[SerializeField]
[SerializeField, FixedNumber]
private long _bonusHeight;
public long BonusHeight {get {return _bonusHeight;}}

private long _offset;

Expand Down
37 changes: 25 additions & 12 deletions Core/Game/Abilities/Essential/Move.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Move : ActiveAbility
public const long GroupDirectStop = FixedMath.One;
public const long DirectStop = FixedMath.One / 8;
private const int MinimumOtherStopTime = (int)(LockstepManager.FrameRate / 4);
private const int repathRate = (int)LockstepManager.FrameRate * 4 / 4;
private const int repathRate = (int)LockstepManager.FrameRate;
private const int CollisionStopCount = LockstepManager.FrameRate * 2;
private const long CollisionStopTreshold = FixedMath.One / 2;

Expand All @@ -26,7 +26,7 @@ public class Move : ActiveAbility

private int RepathRate
{
get { return LSUtility.GetRandom(FixedMath.Create(repathRate).Div(this.Speed).CeilToInt()); }
get { return FixedMath.Create(repathRate).Div(this.Speed).CeilToInt(); }
}

private const int straightRepathRate = repathRate * 4;
Expand Down Expand Up @@ -120,12 +120,22 @@ public bool CanMove {
get { return _canMove; }
}

[SerializeField]
private bool _canTurn = true;
public bool CanTurn {get; private set;}
[SerializeField, FixedNumber]
private long _speed = FixedMath.One * 4;
public long Speed {get {return _speed;}}
[SerializeField]
private bool _canTurn = true;
public bool CanTurn {get; private set;}

[SerializeField, FixedNumber]
private long _speed = FixedMath.One * 4;

public virtual long Speed
{
get { return _speed; }
//set { _speed = value; }
//This'll make Speed indeterministic across multiple sessions since the original value isn't stored and reset
//Underlying value can't be changed but we can make Speed virtual to return a modified value
}


[SerializeField, FixedNumber]
private long _acceleration = FixedMath.One;
public long Acceleration {get {return _acceleration;}}
Expand Down Expand Up @@ -191,7 +201,7 @@ protected override void OnSimulate()
{
if (CanPathfind)
{
if (repathCount <= 0)
if (repathCount <= 0)
{
if (viableDestination)
{
Expand Down Expand Up @@ -246,6 +256,7 @@ protected override void OnSimulate()
}
} else
{

}
} else
{
Expand All @@ -264,7 +275,7 @@ protected override void OnSimulate()
repathCount--;
} else
{
repathCount--;
repathCount-= 2;
}
}

Expand Down Expand Up @@ -301,7 +312,7 @@ protected override void OnSimulate()
if (distance > closingDistance || movingToWaypoint)
{
desiredVelocity = (movementDirection);
if (movementDirection.Cross(lastMovementDirection.x, lastMovementDirection.y).AbsMoreThan(FixedMath.Half))
if (movementDirection.Cross(lastMovementDirection.x, lastMovementDirection.y).AbsMoreThan(FixedMath.One / 4))
{
lastMovementDirection = movementDirection;
if (CanTurn)
Expand Down Expand Up @@ -347,9 +358,11 @@ protected override void OnSimulate()
}
}

public Command LastCommand;

protected override void OnExecute(Command com)
{

LastCommand = com;
if (com.ContainsData<Vector2d> ())
{
Agent.StopCast(ID);
Expand Down
Loading