Пример #1
0
    private void RUN_NONE_SELECTED()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit2D hit = Physics2D.Raycast(Input.mousePosition, Vector2.zero);

            if (hit.collider != null)
            {
                if (hit.collider.GetComponent <ED_OP_Ply>() != null)
                {
                    Debug.Log("player");
                    Debug.Log(hit.transform.position);
                    ED_OP_Ply p = hit.collider.GetComponent <ED_OP_Ply>();
                    for (int i = 0; i < mAths.Count; i++)
                    {
                        if (mAths[i].mTag == p.mTag)
                        {
                            ixPly = i;
                            EXIT_NONE_SELECTED();
                            ENTER_SELECTED();
                            break;
                        }
                    }
                }
            }
        }
    }
Пример #2
0
    // This has nasty side effects. For one, overwrites existing roles.
    private void SetUpNewFormation(string name)
    {
        // ----------------------------- Destroy the old spawned items
        ED_OP_Ply[] plys = FindObjectsOfType <ED_OP_Ply>();
        foreach (ED_OP_Ply p in plys)
        {
            Destroy(p.gameObject);
        }

        // ----------------------------- Clear the play data.
        mPlay.mName      = "NAME ME";
        mPlay.mFormation = name;
        mPlay.mRoutes.Clear();

        // ----------------------------- Spawn the new formation.
        mAths.Clear();
        DATA_Formation f = IO_Formations.FLOAD_FORMATION(name);

        for (int i = 0; i < f.mSpots.Length; i++)
        {
            int x = (int)mSnapSpot.x;
            int y = (int)mSnapSpot.y;
            x += (int)(f.mSpots[i].x / 2);
            y += (int)f.mSpots[i].y / 2;
            Vector3 vPos  = rGrid.FGetPos(x, y);
            var     clone = Instantiate(PF_Ath, vPos, transform.rotation);
            clone.rectTransform.SetParent(rGrid.transform);

            ED_OP_Ply p = clone.GetComponent <ED_OP_Ply>();
            p.mTag  = f.mTags[i];
            p.mRole = "NO_ROLE";
            if (p.mTag.Contains("OL"))
            {
                p.mRole = "BLOCK";
            }
            else if (p.mTag.Contains("QB"))
            {
                p.mRole = "QB";
            }
            p.mIxX = x;
            p.mIxY = y;
            mAths.Add(p);
        }

        // --------------------------- Clear the active route list and the graphics.
        rRouteNodes.Clear();
        DestroyJobGraphics();
    }