Beispiel #1
0
        public override void Update(Chunk chunk)
        {
            float dt = Game1.DeltaT;
            float direction, view;

            ViewCone.ToDegrees(out direction, out view);

            switch (State)
            {
            case AIState.Turning:
                if (direction < Extents.X || Extents.Y < direction)
                {
                    Velocity  = 0;
                    EdgeTimer = EdgeWaitTime;
                    State     = AIState.Waiting;
                }
                break;

            case AIState.Waiting:
                EdgeTimer -= dt;
                if (EdgeTimer <= 0)
                {
                    State = AIState.Turning;
                    if (direction < Extents.X)
                    {
                        Velocity = +RotationSpeed;
                    }
                    else
                    {
                        Velocity = -RotationSpeed;
                    }
                }
                break;
            }

            direction += Velocity * dt;
            ViewCone.FromDegrees(direction, view);
            base.Update(chunk);
        }
Beispiel #2
0
 public PivotCamera(Vector2 position, Game1 game) : base(position, 0, game)
 {
     ViewCone.FromDegrees(Extents.X, 33);
 }