Exemplo n.º 1
0
 public CBuildLineAction(CVShape owner, CVPoint point, CVLineSegment segment, Vector3 hitPos) : base(owner)
 {
     point1       = new CVPointWrap(owner, point);
     this.segment = new CVSegmentWrap(owner, segment);
     this.hitPos  = segment.Owner.CalcHitPosition(this.segment.Index, hitPos);
     divideAction = new CDivideLineAction(Owner, segment.Owner, this.segment.Index, this.hitPos);
 }
Exemplo n.º 2
0
        public void Apply(IData data)
        {
            switch (CurState)
            {
            case State.CreatePoint:
                if (curAction != null && curAction.IsDone)
                {
                    actionController.Apply(curAction);
                    var tranporter = (curAction as CCreatePointAction).CreatedPointView
                                     .GetComponentInChildren <AxisTransporter>().gameObject;
                    GameObject.Destroy(tranporter);
                }
                break;

            case State.SetAngle:
                if (activeSegments.Count == 2)
                {
                    int?angle = null;
                    if (data != null)
                    {
                        angle = (data as AngleSettingData).AngleValue;
                    }
                    var action = new CAngleSettingAction(this, activeSegments.Top, activeSegments.Bottom, angle);
                    actionController.Apply(action);
                }
                break;

            case State.BuildLine:
                if (curAction != null && curAction.IsDone)
                {
                    actionController.Apply(curAction);
                }
                break;

            case State.DivideLine:
                if (activeSegments.Count == 1)
                {
                    var action = new CDivideLineAction(this, activeSegments.Top, (data as LineDividingData).Ratio);
                    actionController.Apply(action);
                }
                break;
            }
            ResetSelection();
            curAction = null;
        }