Example #1
0
    // Private
    private void ActionClick()
    {
        ActionCellParam actionCellParam = new ActionCellParam();

        if (target.GetComponent <BaseSceneObject>() != null)
        {
            actionCellParam.actionName  = actionName;
            actionCellParam.sceneObject = target.GetComponent <BaseSceneObject>();
        }
        if (target.GetComponent <BaseNPC>() != null)
        {
            actionCellParam.actionName = actionName;
            actionCellParam.NPC        = target.GetComponent <BaseNPC>();
        }
        // Action
        ActionCell?.Invoke(actionCellParam);
    }
Example #2
0
    private void ActionMenu(ActionCellParam actionCellParam)
    {
        // NPC
        if (actionCellParam.NPC != null &&
            actionCellParam.NPC.GetComponent <BaseNPC>() != null)
        {
            if (Vector3.Distance(actionCellParam.NPC.transform.position, gameObject.transform.position) > GameParams.actionDistance)
            {
                ChatParam.AddMSG("You too far");
                return;
            }
            switch (actionCellParam.actionName)
            {
            case "Loock":
                ChatParam.AddMSG("You loock at: " + actionCellParam.NPC.NPCParam.privateParams.name);
                break;

            case "Talk":
                // Cloase Prev Panel
                UIBuilder.ClosePanel("PanelNPCDialog");
                // Open New NPC Dialog Panel
                GameObject     NPCDialog      = UIBuilder.OpenPanel("PanelNPCDialog");
                PanelNPCDialog panelNPCDialog = NPCDialog.GetComponent <PanelNPCDialog>();
                panelNPCDialog.SetParam(actionCellParam.NPC.GetComponent <BaseNPC>());
                break;
            }
        }
        // Scene Object
        if (actionCellParam.sceneObject != null &&
            actionCellParam.sceneObject.GetComponent <BaseSceneObject>() != null)
        {
            if (Vector3.Distance(actionCellParam.sceneObject.transform.position, gameObject.transform.position) > GameParams.actionDistance)
            {
                ChatParam.AddMSG("You too far");
                return;
            }
            switch (actionCellParam.actionName)
            {
            case "Loock":
                ChatParam.AddMSG("Description: " + actionCellParam.sceneObject.description);
                break;

            case "Hurvest":

                break;

            case "GetStick":

                break;

            case "CutTree":

                break;

            case "Open":
                // Close Pld Panel
                UIBuilder.ClosePanel("PanelBoxInventory");
                // Open Box Inventory Panel
                GameObject panelBoxInventory = UIBuilder.OpenPanel("PanelBoxInventory");
                panelBoxInventory.GetComponent <PanelBoxInventory>().UpdatePanel(actionCellParam.sceneObject);
                break;
            }
        }
        UIBuilder.ClosePanel("PanelActionMenu");
        UIBuilder.UpdateAllPanels();
    }