Beispiel #1
0
        public void take_damage(int dmg, List <string> msgBuf, Floor fl)
        {
            msgBuf.Add("The " + name + " takes " + dmg + " damage!");
            fl.add_new_popup("-" + dmg, Popup.popup_msg_color.Red, my_grid_coord);
            HP -= dmg;
            if (my_doodad_type == Doodad_Type.Door)
            {
                fl.sound_pulse(my_grid_coord, dmg * 3, SoundPulse.Sound_Types.Player);
                int door_unstick_chance = 25 + dmg * 2;
                if (my_door_state == Door_State.Stuck && rGen.Next(100) < door_unstick_chance)
                {
                    my_door_state = Door_State.Closed;
                    fl.add_new_popup("Unstuck!", Popup.popup_msg_color.Orange, my_grid_coord);
                }
            }

            if (HP <= 0)
            {
                passable    = true;
                destroyable = false;
                blocks_los  = false;
                if (my_doodad_type == Doodad_Type.Door)
                {
                    my_door_state       = Door_State.Destroyed;
                    my_passable_texture = my_destroyed_texture;
                }
            }
        }
Beispiel #2
0
    public void OpenDoors(bool open)
    {
        float moment = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;

        main_collider.enabled = !open;

        if (open)
        {
            state = Door_State.OPENING;
        }
        else
        {
            state = Door_State.CLOSING;
        }

        animator.SetInteger("State", (int)state);

        if (!animator.GetCurrentAnimatorStateInfo(0).IsName(state.ToString()))
        {
            if (moment > 0 && moment < 1)
            {
                animator.Play(state.ToString(), 0, 1 - moment);
            }
        }
    }
Beispiel #3
0
 public void close_door(Floor fl)
 {
     fl.add_new_popup("Closed!", Popup.popup_msg_color.Orange, my_grid_coord);
     my_door_state = Door_State.Closed;
     destroyable   = true;
     passable      = false;
     blocks_los    = true;
 }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     if (!animator.GetCurrentAnimatorStateInfo(0).IsName(state.ToString()))
     {
         if (animator.GetCurrentAnimatorStateInfo(0).IsName("OPEN"))
         {
             state = Door_State.OPEN;
         }
         else if (animator.GetCurrentAnimatorStateInfo(0).IsName("CLOSED"))
         {
             state = Door_State.CLOSED;
         }
     }
 }
Beispiel #5
0
        public void open_door(Floor fl)
        {
            switch (my_door_state)
            {
            case Door_State.Stuck:
                fl.add_new_popup("Stuck!", Popup.popup_msg_color.Orange, my_grid_coord);
                break;

            case Door_State.Locked:
                fl.add_new_popup("Locked!", Popup.popup_msg_color.Orange, my_grid_coord);
                break;

            default:
                my_door_state = Door_State.Open;
                destroyable   = false;
                passable      = true;
                blocks_los    = false;
                break;
            }
        }
Beispiel #6
0
        public Doodad(Doodad_Type dType, ContentManager cManage, gridCoordinate s_coord, int s_ind,
                      bool stone_doorframe = false)
        {
            my_doodad_type = dType;
            HP             = 0;
            switch (my_doodad_type)
            {
            case Doodad_Type.ArmorSuit:
                my_impassable_texture = cManage.Load <Texture2D>("Enemies/hollowKnight_idle");
                my_passable_texture   = cManage.Load <Texture2D>("Entities/broken_armor");
                name        = "suit of armor";
                passable    = false;
                destroyable = true;
                blocks_los  = false;
                HP          = 22;
                break;

            case Doodad_Type.Destroyed_ArmorSuit:
                my_impassable_texture = cManage.Load <Texture2D>("Entities/broken_armor");
                my_passable_texture   = cManage.Load <Texture2D>("Entities/broken_armor");
                name        = "suit of armor";
                passable    = true;
                destroyable = false;
                blocks_los  = false;
                break;

            case Doodad_Type.CorpsePile:
                my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/corpsepile");
                my_passable_texture   = my_impassable_texture;
                name        = "corpse pile";
                passable    = true;
                destroyable = false;
                blocks_los  = false;
                break;

            case Doodad_Type.Door:
                if (stone_doorframe)
                {
                    my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/stonewall_woodendoor");
                    my_passable_texture   = cManage.Load <Texture2D>("Background/Doodads/stonewall_woodendoor_open");
                    my_destroyed_texture  = cManage.Load <Texture2D>("Background/Doodads/stonewall_woodendoor_destroyed");
                }
                else
                {
                    my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/woodwall_woodendoor");
                    my_passable_texture   = cManage.Load <Texture2D>("Background/Doodads/woodwall_woodendoor_open");
                    my_destroyed_texture  = cManage.Load <Texture2D>("Background/Doodads/woodwall_woodendoor_destroyed");
                }
                name          = "door";
                my_door_state = Door_State.Closed;
                passable      = false;
                destroyable   = true;
                blocks_los    = true;
                HP            = 17;
                break;

            case Doodad_Type.Altar:
                cmgr = cManage;
                my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/altar");
                my_passable_texture   = cManage.Load <Texture2D>("Background/Doodads/altar_destroyed");
                name        = "altar";
                passable    = false;
                destroyable = false;
                blocks_los  = false;
                break;

            case Doodad_Type.Blood_Splatter:
                my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/splat");
                my_passable_texture   = my_impassable_texture;
                name        = "blood splatter";
                passable    = true;
                destroyable = false;
                blocks_los  = false;
                break;

            case Doodad_Type.Cage:
                my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/cage");
                my_passable_texture   = cManage.Load <Texture2D>("Background/Doodads/cage");
                name        = "cage";
                passable    = false;
                destroyable = true;
                blocks_los  = false;
                HP          = 20;
                break;

            case Doodad_Type.Bookshelf:
                my_impassable_texture = cManage.Load <Texture2D>("Background/Doodads/bookshelf");
                my_passable_texture   = cManage.Load <Texture2D>("Background/Doodads/bookshelf_destroyed");
                name        = "bookshelf";
                passable    = false;
                destroyable = true;
                blocks_los  = true;
                HP          = 10;
                break;

            case Doodad_Type.Destroyed_Bookshelf:
                my_passable_texture = cManage.Load <Texture2D>("Background/Doodads/bookshelf_destroyed");
                name        = "bookshelf";
                passable    = true;
                destroyable = false;
                blocks_los  = false;
                break;
            }
            rGen             = new Random();
            index            = s_ind;
            my_grid_coord    = s_coord;
            drawing_position = new Vector2(my_grid_coord.x * 32, my_grid_coord.y * 32);
        }
Beispiel #7
0
 public void set_door_state(Door_State next_state)
 {
     my_door_state = next_state;
 }