protected override void LoadContent()
        {
            background = content.Load <Texture2D>(@"Images\Menu Screens\splash-screen-bg");
            foreground = content.Load <Texture2D>(@"Images\Menu Screens\splash-screen-fg");
            font       = content.Load <SpriteFont>(@"Fonts\Trajan");

            windSound = content.Load <SoundEffect>(@"Sounds\wind");
            menuMusic = content.Load <Song>(@"Sounds\music");

            windEffectInstance          = windSound.CreateInstance();
            windEffectInstance.IsLooped = true;
            windEffectInstance.Volume   = GameReference.Settings.SoundEffectsVolume;
            windEffectInstance.Play();

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume      = GameReference.Settings.MusicVolume;
            MediaPlayer.Play(menuMusic);

            cloud = content.Load <Texture2D>(@"Images\Miscellaneous\cloud");

            clouds = new CloudComponent(2, cloud, GameReference, 35, 50);

            Vector2 size = font.MeasureString(message);

            position = new Vector2((ASummonersTaleGame.ScreenRectangle.Width - size.X),
                                   ASummonersTaleGame.ScreenRectangle.Bottom - 50 - font.LineSpacing);

            base.LoadContent();
        }
Пример #2
0
        IEnumerator DispatchMixerEvent(List <GameObject> gameObjects)
        {
            isWaiting = true; // don't dispatch any more until we're done here (prevents repeat dispatches)

            yield return(new WaitForSeconds(1));

            // after selecting specific ids, should still be a count of two
            if (gameObjects
                .Where(x =>
                       x.gameObject.GetComponent <CloudComponent>().cId == "5bb31f90023eb3359042462e" || // aluminum chips
                       x.gameObject.GetComponent <CloudComponent>().cId == "5bb31f99023eb3359042462f")   // iron oxide powder
                .ToList().Count == 2)
            {
                // load in the thermite
                GameObject gameObject = (GameObject)Instantiate(
                    Resources.Load("Bottles/Mesh/Bottle 01", typeof(GameObject)),
                    centre,
                    new Quaternion(0, 0, 0, 1),
                    GameObject.Find("/SceneContent/CloudObjects").transform);

                gameObject.layer = 8; // layer 8 = cloudobjects layer
                gameObject.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);

                gameObject.name = "Thermite";
                gameObject.AddComponent <ObjectPopupName>(); // show name on focus

                // add various props from the cloudobject that aren't already present
                CloudComponent cloudComponent = gameObject.AddComponent <CloudComponent>();
                cloudComponent.cId          = "5bb425bccc7ed83ee3cfbd8d"; // these values will eventually be from the db
                cloudComponent.cSignificant = true;

                // components required for picking up the object
                HandDraggable draggable = gameObject.AddComponent <HandDraggable>();
                draggable.StartedDragging += () => GameObject.Find("/SceneContent/CloudSession")
                                             .GetComponent <CloudSessionManager>()
                                             .HandleUserSelfGrab(gameObject);
                draggable.StoppedDragging += () => GameObject.Find("/SceneContent/CloudSession")
                                             .GetComponent <CloudSessionManager>()
                                             .HandleUserSelfDrop(gameObject);

                gameObject.AddComponent <Rigidbody>();
                gameObject.AddComponent <BoxCollider>();

                // log the transform event
                TransformEvent transformEvent = this.gameObject.GetComponent <TransformEvent>();
                transformEvent.Trigger(gameObject, gameObjects);

                gameObjects.ForEach(obj =>
                {
                    // remove the objects to replace them with the thermite
                    Destroy(obj);
                });

                isWaiting = false;
            }
        }
Пример #3
0
        public void Import()
        {
            if (!string.IsNullOrEmpty(scenarioID))
            {
                Transform cloudObjParent = GameObject.Find("/SceneContent/CloudObjects").transform;
                WWW       ep             = new WWW(string.Format(apiEndpoint, scenarioID));
                while (!ep.isDone)
                {
                    ;
                }

                if (!string.IsNullOrEmpty(ep.text))
                {
                    CloudScenarioResponse res = JsonConvert.DeserializeObject <CloudScenarioResponse>(ep.text);

                    foreach (CloudObject obj in res.scenario.objects)
                    {
                        UnityMainThreadDispatcher.Instance().Enqueue(() =>
                        {
                            GameObject gameObject = (GameObject)Instantiate(
                                Resources.Load(obj.path, typeof(GameObject)),
                                new Vector3(obj.x, obj.y, obj.z),
                                new Quaternion(obj.pitch, obj.yaw, obj.roll, 1),
                                GameObject.Find("/SceneContent/CloudObjects").transform);

                            gameObject.layer = 8; // layer 8 = cloudobjects layer
                            gameObject.transform.localScale = new Vector3(obj.scale_x, obj.scale_y, obj.scale_z);

                            gameObject.name = obj.name;
                            gameObject.AddComponent <ObjectPopupName>(); // show name on focus

                            // add various props from the cloudobject that aren't already present
                            CloudComponent cloudComponent = gameObject.AddComponent <CloudComponent>();
                            cloudComponent.cId            = obj.id;
                            cloudComponent.cSignificant   = obj.significant;

                            // components required for picking up the object
                            HandDraggable draggable    = gameObject.AddComponent <HandDraggable>();
                            draggable.StartedDragging += () => GameObject.Find("/SceneContent/CloudSession")
                                                         .GetComponent <CloudSessionManager>()
                                                         .HandleUserSelfGrab(gameObject);
                            draggable.StoppedDragging += () => GameObject.Find("/SceneContent/CloudSession")
                                                         .GetComponent <CloudSessionManager>()
                                                         .HandleUserSelfDrop(gameObject);

                            gameObject.AddComponent <Rigidbody>();
                            gameObject.AddComponent <BoxCollider>();

                            // perception logging
                            gameObject.AddComponent <PerceptionEvent>();
                        });
                    }
                }
            }
        }
        // handling objects remotely and locally
        public void HandleUserSelfGrab(GameObject gameObject)
        {
            dragging = gameObject;
            CloudComponent cloudComponent = gameObject.GetComponent <CloudComponent>();

            refUsers.Child(userName__NO_TOUCH).Child("inventory").UpdateChildrenAsync(new Dictionary <string, object>()
            {
                { "cid", cloudComponent.cId },

                { "pos_x", cloudComponent.gameObject.transform.position.x },
                { "pos_y", cloudComponent.gameObject.transform.position.y },
                { "pos_z", cloudComponent.gameObject.transform.position.z },

                { "quat_x", cloudComponent.gameObject.transform.rotation.x },
                { "quat_y", cloudComponent.gameObject.transform.rotation.y },
                { "quat_z", cloudComponent.gameObject.transform.rotation.z },
                { "quat_w", cloudComponent.gameObject.transform.rotation.w }
            });
        }