Example #1
0
    public void FPlaceNode(int ixX, int ixY, ED_RP_Grd grd)
    {
        Vector3         vRecPos = grd.mSquares[ixX, ixY].transform.position;
        ED_OP_GFX_RT_ND n       = Instantiate(GFX_Rt_Nd, vRecPos, transform.rotation);

        n.mIxX = ixX;
        n.mIxY = ixY;
        rRouteNodes.Add(n);
        n.transform.SetParent(grd.transform);
    }
Example #2
0
    public void FPlaceFirst(int ixX, int ixY, ED_RP_Grd grd)
    {
        rRouteNodes = new List <ED_OP_GFX_RT_ND>();
        // Put a route node down right where the player is.
        Vector3         vRecPos = grd.mSquares[ixX, ixY].transform.position;
        ED_OP_GFX_RT_ND n       = Instantiate(GFX_Rt_Nd, vRecPos, transform.rotation);

        n.mIxX = ixX;
        n.mIxY = ixY;
        rRouteNodes.Add(n);
        n.transform.SetParent(grd.transform);
    }
Example #3
0
    private void ENTER_ROUTE_EDITING()
    {
        mState = STATE.S_ROUTE_EDITING;
        mUI_RouteSaveCancel.SetActive(true);

        // Put a route node down right where the player is.
        Vector3         vRecPos = rGrid.FGetPos(mAths[ixPly].mIxX, mAths[ixPly].mIxY);
        var             clone   = Instantiate(GFX_Rt_Nd, vRecPos, transform.rotation);
        ED_OP_GFX_RT_ND n       = clone.GetComponent <ED_OP_GFX_RT_ND>();

        n.mIxX = mAths[ixPly].mIxX;
        n.mIxY = mAths[ixPly].mIxY;
        rRouteNodes.Add(n);
        clone.GetComponent <Image>().rectTransform.SetParent(rGrid.transform);
    }
Example #4
0
    private void RUN_ROUTE_EDITING()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit2D hit = Physics2D.Raycast(Input.mousePosition, Vector2.zero);

            if (hit.collider != null)
            {
                if (hit.collider.GetComponent <ED_OP_Square>() != null)
                {
                    Debug.Log("Hit grid square");
                    Debug.Log(hit.transform.position);
                    ED_OP_Square    s       = hit.collider.GetComponent <ED_OP_Square>();
                    Vector3         vRecPos = rGrid.FGetPos(s.x, s.y);
                    var             clone   = Instantiate(GFX_Rt_Nd, vRecPos, transform.rotation);
                    ED_OP_GFX_RT_ND n       = clone.GetComponent <ED_OP_GFX_RT_ND>();
                    n.mIxX = s.x;
                    n.mIxY = s.y;
                    rRouteNodes.Add(n);
                    clone.GetComponent <Image>().rectTransform.SetParent(rGrid.transform);
                }
            }
        }
    }