Пример #1
0
    public static void positionAndParent_Meeple(GameObject Meeple, HexaPos position)
    {
        GameObject par  = GameObject.Find("MeepleCollection");
        GameObject fath = new GameObject(Meeple.GetComponent <Meeple>().meepleName);

        fath.transform.localScale = par.transform.lossyScale;
        fath.transform.position   = par.transform.position;


        Meeple.transform.localScale       = par.transform.lossyScale;
        Meeple.transform.position         = par.transform.position;
        Meeple.transform.localEulerAngles = new Vector3(0, 180, 0);

        //Meeple.transform.Translate(new Vector3(0, 0.4f, 0), Space.Self);
        fath.transform.parent   = par.transform;
        Meeple.transform.parent = fath.transform;
        setMeeplePos(Meeple, position);

        Meeple mip = Meeple.GetComponent <Meeple>();

        if (mip.GetType().IsSubclassOf(typeof(Companion)))
        {
            Companion c = Meeple.GetComponent <Companion>();
            if (c.GetType().Name != "PackAnimal")
            {
                c.setFoodPackages_hpBar();
            }
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (radialMenuBool)
        {
            if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
            {
                destroyRadialMenu();
            }
        }
        else
        {
            if (Input.GetMouseButtonDown(1))
            {
                ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit))
                {
                    GameObject hittedOBJ = hit.collider.gameObject;
                    Companion  com       = hittedOBJ.GetComponent <Companion>();
                    if (com != null)
                    {
                        SceneHandler.activeCompanion = com;
                        Vector3 pos = hittedOBJ.transform.position;
                        pos.y += 1.2f;
                        switch (com.GetType().Name)
                        {
                        case "Healer":
                            generateRadialMenu(pos, "Healer");
                            break;

                        case "Hunter":
                            generateRadialMenu(pos, "Worker");
                            break;

                        case "Mercenary":
                            generateRadialMenu(pos, "Mercenary");
                            break;

                        case "Merchant":

                            break;

                        case "Prince":
                            generateRadialMenu(pos, "Prince");
                            break;

                        case "Scout":
                            generateRadialMenu(pos, "Scout");
                            break;

                        case "PackAnimal":
                            generateRadialMenu(pos, "Camel");
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
    }