public RoboCop(PhysicsComponent2D phys, MovementAIComponent2D move, DrawComponent draw) { detectRadius = 400; movement = move; physics = phys; this.draw = draw; state = RoboCopState.STATIC; this.BoundingRectangle = new COMP476Proj.BoundingRectangle(phys.Position, 16, 6); draw.Play(); }
public RoboCop(PhysicsComponent2D phys, MovementAIComponent2D move, DrawComponent draw, RoboCopState pState, float radius) { movement = move; physics = phys; this.draw = draw; state = pState; detectRadius = radius; this.BoundingRectangle = new COMP476Proj.BoundingRectangle(phys.Position, 16, 6); draw.Play(); }
private void transitionToState(RoboCopState pState) { if (state == pState) { return; } switch (pState) { case RoboCopState.STATIC: state = RoboCopState.STATIC; draw.animation = SpriteDatabase.GetAnimation("roboCop_static"); physics.SetSpeed(false); physics.SetAcceleration(false); draw.Reset(); break; case RoboCopState.HIT: state = RoboCopState.HIT; draw.animation = SpriteDatabase.GetAnimation("roboCop_attack"); physics.SetSpeed(false); physics.SetAcceleration(false); draw.Reset(); break; case RoboCopState.PURSUE: if (state == RoboCopState.STATIC) { playSound("Activation"); } if (state != RoboCopState.PATHFIND) { DataManager.GetInstance().numberOfRoboCopsChasing++; draw.Reset(); } state = RoboCopState.PURSUE; draw.animation = SpriteDatabase.GetAnimation("roboCop_walk"); physics.SetSpeed(true); physics.SetAcceleration(true); break; case RoboCopState.PATHFIND: if (state != RoboCopState.PURSUE) { draw.Reset(); } state = RoboCopState.PATHFIND; draw.animation = SpriteDatabase.GetAnimation("roboCop_walk"); physics.SetSpeed(true); physics.SetAcceleration(true); break; } }