예제 #1
0
    // Update arcs
    private void updateArcObjects()
    {
        // Destroy all Arcs connected to the transition element.
        ArcElement[] arcsToDestroy = this.GetComponentsInChildren <ArcElement>();
        for (int idx = 0; idx < arcsToDestroy.GetLength(0); idx++)
        {
            Destroy(arcsToDestroy[idx].gameObject);
        }


        // Create new Arcs.
        ArcElement arc = arcPrefab.GetComponent <ArcElement>();

        arc.transition = this;
        int i = 0;

        foreach (PlaceElement p in preconditions)
        {
            arc.place = p;
            arc.type  = ArcElement.ConditionType.PRECONDITION;
            arc.coeff = preconditionCoefficients[i];
            ++i;
            Instantiate(arc, this.transform);
        }
        i = 0;
        foreach (PlaceElement p in postconditions)
        {
            arc.place = p;
            arc.type  = ArcElement.ConditionType.POSTCONDITION;
            arc.coeff = postconditionCoefficients[i];
            ++i;
            Instantiate(arc, this.transform);
        }
    }
예제 #2
0
    // Create arcs corresponding to given pre/postconditions
    void Start()
    {
        startTime = Time.time;
        ArcElement arc = arcPrefab.GetComponent <ArcElement>();

        arc.transition = this;
        int i = 0;

        foreach (PlaceElement p in preconditions)
        {
            arc.place = p;
            arc.type  = ArcElement.ConditionType.PRECONDITION;
            arc.coeff = preconditionCoefficients[i];
            ++i;
            Instantiate(arc, this.transform);
        }
        i = 0;
        foreach (PlaceElement p in postconditions)
        {
            arc.place = p;
            arc.type  = ArcElement.ConditionType.POSTCONDITION;
            arc.coeff = postconditionCoefficients[i];
            ++i;
            Instantiate(arc, this.transform);
        }
    }
        /// <summary>
        /// Instantiates a PathElement based on the PathElementType
        /// </summary>
        /// <param name="elementType">PathElementType</param>
        /// <returns>ICanvasPathElement</returns>
        private static ICanvasPathElement CreatePathElement(PathElementType elementType)
        {
            ICanvasPathElement result = null;

            switch (elementType)
            {
            case PathElementType.MoveTo:
                result = new MoveToElement();
                break;

            case PathElementType.Line:
                result = new LineElement();
                break;

            case PathElementType.HorizontalLine:
                result = new HorizontalLineElement();
                break;

            case PathElementType.VerticalLine:
                result = new VerticalLineElement();
                break;

            case PathElementType.QuadraticBezier:
                result = new QuadraticBezierElement();
                break;

            case PathElementType.SmoothQuadraticBezier:
                result = new SmoothQuadraticBezierElement();
                break;

            case PathElementType.CubicBezier:
                result = new CubicBezierElement();
                break;

            case PathElementType.SmoothCubicBezier:
                result = new SmoothCubicBezierElement();
                break;

            case PathElementType.Arc:
                result = new ArcElement();
                break;

            case PathElementType.ClosePath:
                result = new ClosePathElement();
                break;
            }

            return(result);
        }
예제 #4
0
 void Awake()
 {
     m_arcElement = GetComponentInChildren <ArcElement>();
     if (m_arcElement == null)
     {
         Debug.LogError("Click Element couldn't find Arc Element component in children");
     }
     m_audioSource = GetComponent <AudioSource>();
     m_outcome     = transform.Find("Outcome").gameObject;
     if (m_outcome == null)
     {
         Debug.Log("ClickElement couldn't find outcome object");
     }
     m_outcome.SetActive(false);
 }
예제 #5
0
		public static void Draw (Context grw, ArcElement arc)
		{
			if (arc.Foregraund != null) {
				grw.SetSourceRGB (
					arc.Foregraund.Red, 
					arc.Foregraund.Green, 
					arc.Foregraund.Blue);
			}

			grw.Arc (
				arc.Center.GeometryX, 
				arc.Center.GeometryY, 
				arc.GeometryRadius, 
				arc.ArcStart, 
				arc.ArcStop);

			grw.Stroke ();
		}
예제 #6
0
        public static void Draw(Context grw, ArcElement arc)
        {
            if (arc.Foregraund != null)
            {
                grw.SetSourceRGB(
                    arc.Foregraund.Red,
                    arc.Foregraund.Green,
                    arc.Foregraund.Blue);
            }

            grw.Arc(
                arc.Center.GeometryX,
                arc.Center.GeometryY,
                arc.GeometryRadius,
                arc.ArcStart,
                arc.ArcStop);

            grw.Stroke();
        }
예제 #7
0
    // Create arcs corresponding to given pre/postconditions
    void Start()
    {
        ArcElement arc = arcPrefab.GetComponent <ArcElement>();

        arc.transition = this;
        foreach (PlaceElement p in preconditions)
        {
            arc.place = p;
            arc.type  = ArcElement.ConditionType.PRECONDITION;
            arc.coeff = 1;
            Instantiate(arc, this.transform);
        }
        foreach (PlaceElement p in postconditions)
        {
            arc.place = p;
            arc.type  = ArcElement.ConditionType.POSTCONDITION;
            Instantiate(arc, this.transform);
        }
    }