-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installed package for java style concurrent RNG, reworked cacti AI.
- Loading branch information
1 parent
8738b81
commit 074b2d3
Showing
14 changed files
with
96 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,84 @@ | ||
using OpenTK; | ||
using RabbetGameEngine.Models; | ||
using RabbetGameEngine.Physics; | ||
using System; | ||
namespace RabbetGameEngine | ||
{ | ||
public class EntityCactus : EntityLiving | ||
{ | ||
private bool turn = true; | ||
private static Random rand = new Random(); | ||
public EntityCactus() : base() | ||
private bool turningRight = false; | ||
private bool turningLeft = false; | ||
private bool walkingFowards = false; | ||
private float rotationSpeed = 2.5F; | ||
public EntityCactus(Planet planet) : base(planet) | ||
{ | ||
this.walkSpeed = 0.025F; | ||
this.entityModel = new EntityCactusModel(this); | ||
this.hasModel = true; | ||
this.collider = new AABB(new Vector3(-0.5F, -0.5F, -0.5F), new Vector3(0.5F, 0.5F, 0.5F), this); | ||
this.hasCollider = true; | ||
yaw = (float)rand.NextDouble() * 360; | ||
yaw = (float)currentPlanet.rand.NextDouble() * 360; | ||
walkFowards(); | ||
} | ||
public EntityCactus(Vector3 pos) : base(pos) | ||
public EntityCactus(Planet planet, Vector3 pos) : base(planet, pos) | ||
{ | ||
this.walkSpeed = 0.025F; | ||
this.entityModel = new EntityCactusModel(this); | ||
this.hasModel = true; | ||
this.collider = new AABB(new Vector3(-0.5F, -0.5F, -0.5F), new Vector3(0.5F, 0.5F, 0.5F), this); | ||
this.hasCollider = true; | ||
yaw = (float)rand.NextDouble() * 360; | ||
yaw = (float)currentPlanet.rand.NextDouble() * 360; | ||
walkFowards(); | ||
} | ||
|
||
public override void onTick() | ||
{ | ||
if(rand.Next(0, 25) == 1) | ||
{ | ||
turn = !turn; | ||
} | ||
if (currentPlanet.rand.Next() % 100 == 0) | ||
{ | ||
walkingFowards = true; | ||
} | ||
|
||
if (turn) rotateYaw(-3.0F); else rotateYaw(3.0F); | ||
if (walkingFowards && currentPlanet.rand.Next() % 20 == 0) | ||
{ | ||
walkingFowards = false; | ||
} | ||
if (walkingFowards) | ||
{ | ||
turningLeft = turningRight = false; | ||
} | ||
else | ||
{ | ||
if (currentPlanet.rand.Next() % 100 == 0) | ||
{ | ||
turningLeft = true; | ||
} | ||
if (turningLeft && currentPlanet.rand.Next() % 10 == 0) | ||
{ | ||
turningLeft = false; | ||
} | ||
if (currentPlanet.rand.Next() % 100 == 0) | ||
{ | ||
turningRight = true; | ||
} | ||
if (turningRight && currentPlanet.rand.Next() % 10 == 0) | ||
{ | ||
turningRight = false; | ||
} | ||
} | ||
if (walkingFowards) | ||
{ | ||
walkFowards(); | ||
} | ||
|
||
walkFowards(); | ||
if (turningLeft) | ||
{ | ||
yaw -= rotationSpeed; | ||
} | ||
|
||
if (rand.Next(0, 50) == 1) | ||
{ | ||
jump(); | ||
} | ||
base.onTick();//do last | ||
if (turningRight) | ||
{ | ||
yaw += rotationSpeed; | ||
} | ||
base.onTick();//do last | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.