コード例 #1
0
    public void CreateMarker(PatternFrameInfo.Preset info, Frame f)
    {
        DirectionMarker marker = Instantiate(markerBase).GetComponent <DirectionMarker>();

        f.markers.Add(marker);

        marker.transform.SetParent(this.transform);
        marker.info = info;

        for (int i = 0; i < presetDatabase.data[info.preset].shots.Count; ++i)
        {
            Transform tp = Instantiate(spikeMarkerBase).transform;
            tp.SetParent(marker.transform);
            tp.rotation = Quaternion.Euler(0f, 0f, presetDatabase.data[info.preset].shots[i].angle);
        }

        marker.transform.rotation = Quaternion.Euler(0f, 0f, info.extraAngle);
        marker.gameObject.SetActive(false);
    }
コード例 #2
0
    public override void Progress(Sync[] s)
    {
        if (Input.GetMouseButtonDown(0))
        {
            mousePos = GetMousePosition();
            if (CollisionCheck(mousePos) != -1)
            {
                if (select == null)
                {
                    isMove = true;

                    AngleSetUp();

                    clickPos = mousePos;
                    select   = this;
                    ColorCheck(true);
                }
                else if (select == this)
                {
                    AngleSetUp();

                    clickPos = mousePos;
                }
                else
                {
                    select.ColorCheck(false);
                    select.isMove = false;

                    AngleSetUp();

                    isMove   = true;
                    clickPos = mousePos;
                    select   = this;
                    ColorCheck(true);
                }
            }
        }

        if (Input.GetMouseButton(0) && select == this)
        {
            mousePos = GetMousePosition();

            if (!isMove)
            {
                if (CollisionCheck(mousePos) != -1)
                {
                    if (clickPos - mousePos != Vector2.zero)
                    {
                        isMove = true;
                    }
                }
            }
            if (isMove)
            {
                GetCurrAngle();

                float angle = originAngle - (clickAngle - currAngle);

                if (Input.GetKey(KeyCode.LeftShift))
                {
                    int factor = 10;
                    if (Input.GetKey(KeyCode.LeftControl))
                    {
                        factor = 30;
                    }

                    angle = (float)((int)angle / factor) * (float)factor;
                }

                transform.rotation = Quaternion.Euler(0f, 0f, angle);
                info.extraAngle    = angle > 180 ? angle - 360f : angle;
                ExtraFunc();
            }
        }

        if (Input.GetMouseButtonUp(0) && select == this)
        {
            if (isMove)
            {
                isMove = false;
            }
            else
            {
                if (CollisionCheck(mousePos) != -1)
                {
                    ColorCheck(false);
                    select = null;
                }
            }
        }
    }