コード例 #1
0
    public void _on_AbilitiesMenu_id_pressed(int id)
    {
        success = true;
        // GD.Print("eeeeeeeeeeee first");
        Crawler crawler = this.GetCrawler();

        Action action;

        if (id < bigNumber)
        {
            action = new ReachAttackAction(attackData[id]);
            // action = new AttackAction();
            // action = new AttackAction(attackData[id]);
        }
        else
        {
            action = (Action)Activator.CreateInstance(Type.GetType(abilities[id - bigNumber]));
        }

        if (action.Range.max == 0)
        {
            crawler.Model.SetPlayerAction(action);
            crawler.notPlayerTurn = true;
            crawler.ResetState();
        }
        else
        {
            AbilityTargetInputState to = this.GetNode <AbilityTargetInputState>("Targeting");
            to.action = action;
            crawler.ChangeState(to);
            return;
        }
    }
コード例 #2
0
 public void _on_ItemsMenu_popup_hide()
 {
     if (!success)
     {
         Crawler crawler = this.GetCrawler();
         crawler.ChangeState((InputState)this.GetParent());
     }
     // GD.Print("eeeeeeeeeeee second");
 }
コード例 #3
0
    private bool TransitionInput(Crawler crawler, InputEvent ev)
    {
        if (ev.IsActionPressed("menu_abilities", false))
        {
            crawler.ChangeState(this.GetNode <InputState>("Ability"));
            return(true);
        }

        if (ev.IsActionPressed("menu_items", false))
        {
            crawler.ChangeState(this.GetNode <InputState>("Item"));
            return(true);
        }

        if (ev.IsActionPressed("look"))
        {
            crawler.ChangeState(this.GetNode <InputState>("Look"));
            return(true);
        }

        return(false);
    }
コード例 #4
0
    public void _on_ItemsMenu_id_pressed(int id)
    {
        success = true;
        Crawler crawler = this.GetCrawler();

        Action action = new UseItemAction(crawler.Model.GetPlayer(), 3458799);

        if (action.Range.max == 0)
        {
            crawler.Model.SetPlayerAction(action);
            crawler.notPlayerTurn = true;
            crawler.ResetState();
        }
        else
        {
            AbilityTargetInputState to = this.GetNode <AbilityTargetInputState>("Targeting");
            to.action = action;
            crawler.ChangeState(to);
            return;
        }
    }