Example #1
0
        private void SetTemplate()
        {
            CStage = new CanvasStage( Stage );
            CStage.Add( new Fireworks() );

            Unloaded += About_Unloaded;
        }
Example #2
0
 void Destroy()
 {
     _stage            = null;
     _challengeManager = null;
     _loadScene        = null;
     _gameControl      = null;
 }
Example #3
0
        // Use this for initialization
        void Start()
        {
            if (bulbs == null)
            {
                bulbs = new List <DraggablePoint>();
            }
            if (splines == null)
            {
                splines = new List <CatmullRomSpline>();
            }

            dBulbs  = new List <DCurveBulb>();
            dCurves = new List <DiscreteCurve>();

            tiBulbs  = new List <DCurveBulb>();
            tiCurves = new List <TorsionImpulseCurve>();

            stage = CanvasStage.Spline;

            /*
             * CatmullRomSpline crs = AddSpline(new Vector3(-2, 1, 0));
             * crs.points.Add(new Vector3(-1, 1, 0));
             * crs.points.Add(new Vector3(1, 1, 0));
             * crs.points.Add(new Vector3(2, 1, 0));*/
        }
Example #4
0
        public void SplineToDCurve()
        {
            Dictionary <DraggablePoint, DCurveBulb> bulbDict = new Dictionary <DraggablePoint, DCurveBulb>();

            foreach (DraggablePoint bulb in bulbs)
            {
                DCurveBulb dcBulb = bulb.ConvertToBulb();
                dBulbs.Add(dcBulb);
                bulbDict.Add(bulb, dcBulb);
            }

            foreach (CatmullRomSpline spline in splines)
            {
                DiscreteCurve dc = spline.ConvertToDCurve();

                if (spline.StartBulb)
                {
                    DCurveBulb parentOfSpline = bulbDict[spline.StartBulb];
                    dc.parentBulb = parentOfSpline;
                    parentOfSpline.childCurves.Add(dc);
                }
                if (spline.EndBulb)
                {
                    DCurveBulb endOfSpline = bulbDict[spline.EndBulb];
                    dc.childBulb            = endOfSpline;
                    endOfSpline.parentCurve = dc;
                }

                AddDCurve(dc);
            }

            stage = CanvasStage.DCurve;
        }
Example #5
0
 public void StartInit()
 {
     _myTransform      = GetComponent <RectTransform>();
     _stage            = GameObject.FindObjectOfType <CanvasStage>();
     _gameControl      = GameControl.instance;
     _challengeManager = GameObject.FindObjectOfType <ChallengeManager>();
     _loadScene        = GameObject.FindObjectOfType <LoadScene>();
 }
Example #6
0
        private void About_Unloaded( object sender, RoutedEventArgs e )
        {
            Stage.RemoveFromVisualTree();
            Stage = null;

            CStage.Dispose();
            CStage = null;
        }
Example #7
0
        private void SetTemplate()
        {
            CvsStage = new CanvasStage(Stage);

            ACSConf = GRConfig.ContentReader.AccelerScroll;
            AccTest = new AccelerTest();
            CvsStage.Add(AccTest);
        }
Example #8
0
        private void SetTemplate()
        {
            TestTwitter();

            CStage = new CanvasStage(Stage);
            CStage.Add(new Fireworks());
            Stage.Paused = true;

            Unloaded += About_Unloaded;
        }
Example #9
0
        private void About_Unloaded(object sender, RoutedEventArgs e)
        {
            if (Stage != null)
            {
                Stage.RemoveFromVisualTree();
                Stage = null;

                CStage.Dispose();
                CStage = null;
            }
        }
Example #10
0
        public void ConfirmTIC()
        {
            stage = CanvasStage.ImpulseCurve;

            foreach (DCurveBulb db in dBulbs)
            {
                db.gameObject.SetActive(false);
            }
            foreach (DiscreteCurve dc in dCurves)
            {
                dc.gameObject.SetActive(false);
            }
        }
Example #11
0
        public HyperBannerItem(ActiveItem Item, Stack <Particle> PStack)
        {
            Source = Item;

            CanvasElem = new CanvasAnimatedControl();
            CanvasElem.UseSharedDevice = true;

            Stage = new CanvasStage(CanvasElem);

            FireFliesScene = new FireFlies(PStack);
            Stage.Add(FireFliesScene);

            UpdateGrid();
        }
Example #12
0
        private void SetBackground()
        {
            CStage = new CanvasStage( Stage );

            Glitter = new Glitter();

            CStage.Add( Glitter );

            HomeHub.ViewChanged += HomeHub_ViewChanged;
        }
Example #13
0
        public void TICToTelescope()
        {
            // Create a telescope structure empty object
            GameObject structureObj = new GameObject();

            structureObj.name = "TelescopingStructure";
            TelescopeStructure structure = structureObj.AddComponent <TelescopeStructure>();

            structure.transform.parent = transform;

            // Create dictionary to record created telescope junctures
            Dictionary <DCurveBulb, TelescopeJuncture> bulbDict = new Dictionary <DCurveBulb, TelescopeJuncture>();

            // Create all of the junctures, and hash the original abstract intersections to them
            foreach (DCurveBulb dcb in tiBulbs)
            {
                TelescopeJuncture junct = TelescopeJuncture.CreateJuncture(dcb.transform.position, dcb.radius * Mathf.Sqrt(2));
                bulbDict.Add(dcb, junct);
                structure.junctures.Add(junct);
                junct.transform.parent = structure.transform;
            }

            // Now we need to loop over all telescope segments,
            // create the telescopes, and attach them to the correct junctions.
            foreach (TorsionImpulseCurve tic in tiCurves)
            {
                // Set radius to match the radii at endpoints
                float startRadius = tic.NumSegments * Constants.WALL_THICKNESS + 0.2f
                                    + (tic.ArcLength * Constants.TAPER_SLOPE);

                TelescopeSegment seg;

                // Need to address four cases, corresponding to whether or not
                // the segment is connected to a juncture at the beginning and end.
                // In this step, we just create telescopes with the appropriate radii.
                if (tic.StartJuncture && tic.EndJuncture)
                {
                    if (tic.EndJuncture.radius > tic.StartJuncture.radius)
                    {
                        //startRadius = tic.EndJuncture.radius;
                        startRadius = FindStartRadius(tic.StartJuncture.radius, tic.ArcLength, tic.NumSegments);
                        seg         = tic.MakeTelescope(startRadius, reverse: true);
                    }
                    else
                    {
                        //startRadius = tic.StartJuncture.radius;
                        startRadius = FindStartRadius(tic.EndJuncture.radius, tic.ArcLength, tic.NumSegments);
                        seg         = tic.MakeTelescope(startRadius);
                    }
                }
                else if (tic.StartJuncture && !tic.EndJuncture)
                {
                    startRadius = tic.StartJuncture.radius;
                    seg         = tic.MakeTelescope(startRadius);
                }
                else if (!tic.StartJuncture && tic.EndJuncture)
                {
                    startRadius = tic.EndJuncture.radius;
                    seg         = tic.MakeTelescope(startRadius, reverse: true);
                }
                else
                {
                    seg = tic.MakeTelescope(startRadius);
                }

                seg.transform.parent = structure.transform;
                structure.segments.Add(seg);

                seg.ExtendImmediate(1);

                // Now we actually connect the telescopes.
                // We look up which instantiated telescope object
                // the current segment should be connected to.
                if (tic.StartJuncture)
                {
                    TelescopeJuncture bulb = bulbDict[tic.StartJuncture];
                    seg.keepLocalPositionOnStart = true;
                    seg.SetParent(bulb);

                    bulb.childSegments.Add(seg);
                }
                if (tic.EndJuncture)
                {
                    TelescopeJuncture bulb = bulbDict[tic.EndJuncture];
                    bulb.keepLocalPositionOnStart = true;
                    bulb.SetParentToSegmentEnd(seg);
                }

                // Turn off all of the old objects.
                foreach (DCurveBulb oldBulb in tiBulbs)
                {
                    oldBulb.gameObject.SetActive(false);
                }

                foreach (TorsionImpulseCurve oldTc in tiCurves)
                {
                    oldTc.gameObject.SetActive(false);
                }
            }

            ActiveStructure = structure;
            stage           = CanvasStage.Telescope;
        }