Exemplo n.º 1
0
        public override void Update(float dt)
        {
            if (Game.Player != null && Game.Player.HasPowerup(Powerup.FREEZE_TIME))
            {
                return;
            }

            base.Update(dt);

            if (LeavingArea && WaypointPath.Count > 0)
            {
                if (!Obj.CanMove)
                {
                    // Rotate to first waypoint in path
                    float targetAngle = (float)Utils.GetAngle(Obj.Position, WaypointPath[0]);
                    if (Obj.Rotation != targetAngle)
                    {
                        Obj.Rotation = Utils.RotateTowards(Obj.Rotation, targetAngle, 1);
                    }
                    else
                    {
                        Obj.CanMove = true;
                    }
                }
                else
                {
                    Obj.Rotation = (float)Utils.GetAngle(Obj.Position, WaypointPath[WaypointPath.Count - 1]);
                }
            }
            else if ((!ReachedBeach && WaypointPath.Count > 1))
            {
                Obj.Rotation = (float)Utils.GetAngle(Obj.Position, WaypointPath[WaypointPath.Count - 1]);
            }
        }
Exemplo n.º 2
0
        public override void Update(float dt)
        {
            if (Game.Player != null && Game.Player.HasPowerup(Powerup.FREEZE_TIME))
            {
                return;
            }

            base.Update(dt);

            if (WaypointPath.Count > 1)
            {
                float targetAngle = (float)Utils.GetAngle(Obj.Position, WaypointPath[1]);
                Obj.Rotation = Utils.RotateTowards(Obj.Rotation, targetAngle, 1);
            }
        }