예제 #1
0
 protected void update_move()
 {
     if (moving_full)
     {
         if ((Move_To != Loc.X) || Bob < 0)
         {
             int move_to = Move_To; // Why //Yeti
             Loc.X   = Additional_Math.int_closer((int)Loc.X, move_to, (int)MathHelper.Clamp((int)Math.Round(Math.Abs(Loc.X - move_to)) / Config.FACE_SPRITE_MOVEMENT_BOB_TIME, 1, 8));
             Move_To = move_to;     // why
             if ((Bob < 0) && (Math.Abs((int)Loc.X - Move_To) < Config.FACE_SPRITE_MOVEMENT_BOB_TIME))
             {
                 Bob = Config.FACE_SPRITE_MOVEMENT_BOB_TIME;
             }
         }
         if (Bob == Config.FACE_SPRITE_MOVEMENT_BOB_TIME)
         {
             Loc.Y += 1;
         }
         if (Bob == 0)
         {
             Loc.Y -= 1;
         }
         Bob--;
     }
 }
예제 #2
0
 protected void update_stats()
 {
     for (int i = 0; i < Stats.Count; i++)
     {
         if (Stats[i] != stat(i))
         {
             if (Stats[i] == null || stat(i) == null)
             {
                 Stats[i] = null;
             }
             else
             {
                 Stats[i] = Additional_Math.int_closer((int)Stats[i], (int)stat(i), 1);
             }
         }
     }
 }
예제 #3
0
        protected override void update_phase_0()
        {
            if (Combat_Scene_Fade_In || Preparations_Fade_In)
            {
                bool cont = false;
                while (!cont)
                {
                    cont = true;
                    int alpha;
                    if (Preparations_Fade_In)
                    {
                        switch (Timer)
                        {
                        case 0:
                            promotion_fade_in_initialize();
                            Skip_Fill.tint = new Color(0, 0, 0, 1f);
                            Timer++;
                            break;

                        case 34:
                            Skip_Fill            = null;
                            Preparations_Fade_In = false;
                            if (WaitingOnPromotionChoice)
                            {
                                Timer = 0;
                            }
                            else
                            {
                                Timer = 36;
                            }
                            break;

                        default:
                            if (Timer > 18)
                            {
                                alpha          = (34 - Timer) * 16;
                                Skip_Fill.tint = new Color(0, 0, 0, alpha);
                            }
                            Timer++;
                            break;
                        }
                    }
                    else
                    {
                        switch (Timer)
                        {
                        case 0:
                            promotion_fade_in_initialize();
                            Skip_Fill.tint = new Color(1f, 1f, 1f, 1f);
                            Timer++;
                            break;

                        case 40:
                            Skip_Fill            = null;
                            Combat_Scene_Fade_In = false;
                            if (WaitingOnPromotionChoice)
                            {
                                Timer = 0;
                            }
                            else
                            {
                                Timer = 36;
                            }
                            break;

                        default:
                            if (Timer > 8)
                            {
                                alpha          = (40 - Timer) * 8;
                                Skip_Fill.tint = new Color(alpha, alpha, alpha, alpha);
                            }
                            Timer++;
                            break;
                        }
                    }
                }
            }
            else if (WaitingOnPromotionChoice)
            {
                if (!Music_Started)
                {
                    play_battle_theme();
                    Music_Started = true;
                }

                bool cont = true;
                if (!Global.game_temp.PromotionChoiceMenuCall && !Global.game_temp.menuing)
                {
                    cont = false;
                }
                while (!cont)
                {
                    cont = true;
                    switch (Timer)
                    {
                    case 8:
                        Pan_Vector.X = Additional_Math.int_closer(
                            (int)Pan_Vector.X, 0, 16);
                        if (HUD == null && Pan_Vector.X >= this.OffscreenOffset / 2)
                        {
                            setup_hud();
                        }

                        if (HUD != null && Pan_Vector.X == 0)
                        {
                            Timer++;
                        }
                        break;

                    case 9:
                        WaitingOnPromotionChoice = false;
                        Timer = 36;
                        break;

                    default:
                        Timer++;
                        break;
                    }
                }
            }
            else
            {
                if (!Global.game_temp.PromotionChoiceMenuCall && !Global.game_temp.menuing)
                {
                    base.update_phase_0();
                }
            }
        }
예제 #4
0
        public override void update()
        {
            if (Window_Shake.Count > 0)
            {
                Window_Offset = Window_Shake.shift();
            }
            if (Data_Shake.Count > 0)
            {
                Data_Offset = Data_Shake.shift();
            }

            if (Timer < TIMER_MAX)
            {
                Timer++;
            }

            if (Hp1 != this.hp1 || (unit_2 != null && Hp2 != this.hp2))
            {
                if (Global.Input.triggered(Inputs.A) ||
                    Global.Input.mouse_triggered(MouseButtons.Left) ||
                    Global.Input.gesture_triggered(TouchGestures.Tap))
                {
                    if (Hp1 < this.hp1 || (unit_2 != null && Hp2 < this.hp2))
                    {
                        Global.game_system.play_se(System_Sounds.HP_Recovery);
                    }
                    Hp1 = this.hp1;
                    if (unit_2 != null)
                    {
                        Hp2 = this.hp2;
                    }
                }
            }

            if (Hp1_Timer == 0)
            {
                if (Hp1 < hp1)
                {
                    Global.game_system.play_se(System_Sounds.HP_Recovery);
                    Hp1_Timer = HP_GAIN_TIME;
                }
                Hp1 = Additional_Math.int_closer(Hp1, hp1, 1);
            }
            if (unit_2 != null && Hp2_Timer == 0)
            {
                if (Hp2 < hp2)
                {
                    Global.game_system.play_se(System_Sounds.HP_Recovery);
                    Hp2_Timer = HP_GAIN_TIME;
                }
                Hp2 = Additional_Math.int_closer(Hp2, hp2, 1);
            }
            if (Hp1_Timer > 0)
            {
                Hp1_Timer--;
            }
            if (Hp2_Timer > 0)
            {
                Hp2_Timer--;
            }
            Name1.update();
            HP_Counter1.text = (Hp1 > 99 ? "??" : Hp1.ToString());
            HP_Counter1.update();
            if (unit_2 != null)
            {
                Name2.update();
                HP_Counter2.text = (Hp2 > 99 ? "??" : Hp2.ToString());
                HP_Counter2.update();
            }
            // Update stats
            if (!stat_update_done())
            {
                if (Stat_Timer == 0)
                {
                    update_stats();
                    refresh_battle_stats();
                    Stat_Timer = 2;
                }
            }
            if (Stat_Timer > 0)
            {
                Stat_Timer--;
            }
            foreach (RightAdjustedText text in Stat_Imgs)
            {
                text.update();
            }
        }
예제 #5
0
        public void update_movement()
        {
            if (is_following_unit)
            {
                update_following_unit();
                return;
            }
            bool target_window_up = ((Scene_Map)Global.scene).target_window_up && !((Scene_Map)Global.scene).manual_targeting;
            bool block_scroll     =
                Input.ControlScheme == ControlSchemes.Touch &&
                (is_movement_allowed() || Global.game_temp.menu_call ||
                 Global.game_temp.menuing);

            if (Instant_Movement || !Global.game_state.is_player_turn)
            {
                Instant_Movement = false;
                refresh_real_loc();
                if (!Global.game_system.is_interpreter_running)
                {
                    if (center(Real_Loc / UNIT_TILE_SIZE, true, forced: !block_scroll))
                    {
                        Global.game_map.scroll_speed = -1;
                    }
                }
            }
            else if (!target_window_up)
            {
                if (Global.game_state.is_menuing && !((Scene_Map)Global.scene).manual_targeting)
                {
                    refresh_real_loc();
                }
                else
                {
                    bool moved = (int)Real_Loc.X != (int)Loc.X * UNIT_TILE_SIZE ||
                                 (int)Real_Loc.Y != (int)Loc.Y * UNIT_TILE_SIZE;
                    int dist = (UNIT_TILE_SIZE / 4) * (speed_up_input() ? 2 : 1);
                    if (Global.game_temp.minimap_call)
                    {
                        dist = (UNIT_TILE_SIZE / 2);
                    }

                    Vector2 real_loc = new Vector2(Additional_Math.int_closer((int)Real_Loc.X, (int)Loc.X * UNIT_TILE_SIZE, dist),
                                                   Additional_Math.int_closer((int)Real_Loc.Y, (int)Loc.Y * UNIT_TILE_SIZE, dist));
                    if (Real_Loc != real_loc)
                    {
                        Real_Loc = real_loc;
                    }
                    center(Real_Loc / UNIT_TILE_SIZE, true, forced: !block_scroll);
                    if (moved)
                    {
                        Global.game_map.scroll_speed = dist;
                    }
                }
            }
            else
            {
                Real_Loc.X = (int)(Real_Loc.X + Loc.X * UNIT_TILE_SIZE) / 2;
                Real_Loc.Y = (int)(Real_Loc.Y + Loc.Y * UNIT_TILE_SIZE) / 2;
                center(Real_Loc / UNIT_TILE_SIZE, true, forced: !block_scroll);
            }
        }