Example #1
0
 public static void sceneTransitionByIndex(int sceneIndex){
   var fader = new FadeTransition()
   {
     nextScene = sceneIndex,
     fadedDelay = 0.1f,
     fadeToColor = Color.black
   };
   TransitionKit.instance.transitionWithDelegate( fader );
 }
Example #2
0
 // Use this for initialization
 void TransitionToNextView()
 {
     var fade = new FadeTransition()
     {
         nextScene = SceneManager.GetActiveScene().buildIndex + 1,
         duration = 0.4f,
         fadeToColor = Color.black
     };
     TransitionKit.instance.transitionWithDelegate(fade);
 }
Example #3
0
 void TransitionToNextView()
 {
     var fade = new FadeTransition()
     {
         nextScene = 7,
         duration = 0.4f,
         fadeToColor = Color.black
     };
     TransitionKit.instance.transitionWithDelegate(fade);
 }
Example #4
0
 public IEnumerator IntroWorker()
 {
     yield return new WaitForSeconds(3f);
     var fader = new FadeTransition()
     {
         nextScene = SceneManager.GetActiveScene().buildIndex + 1,
         fadedDelay = 0.2f,
         fadeToColor = Color.black
     };
     TransitionKit.instance.transitionWithDelegate(fader);
 }
Example #5
0
 private void FrmWarning_Load(object sender, EventArgs e)
 {
     FadeTransition.ShowAsyc(this);
 }
 public static void goLevel(int lvl)
 {
     lvlActual = lvl;
     FadeTransition.FadeTo(lvlActual.ToString());
 }
 private void Awake()
 {
     DontDestroyOnLoad(this);
     _Instance = this;
 }
Example #8
0
    private void PickRandomTransition(int sceneNum)
    {
        //int seed = Random.Range(1, 6);
        int seed = 1;

        switch (seed)
        {
        case 1:
            //"Fade to Scene"
            var fader = new FadeTransition()
            {
                nextScene   = sceneNum,
                fadeToColor = Color.black
            };
            TransitionKit.instance.transitionWithDelegate(fader);
            break;

        case 2:
            //"Vertical Slices to Scene"
            var slices = new VerticalSlicesTransition()
            {
                nextScene = sceneNum,
                divisions = Random.Range(3, 20)
            };
            TransitionKit.instance.transitionWithDelegate(slices);
            break;

        case 3:
            //"Blur to Scene"
            var blur = new BlurTransition()
            {
                nextScene = sceneNum
                            //duration = 2.0f,
                            //blurMax = 0.01f
            };
            TransitionKit.instance.transitionWithDelegate(blur);
            break;

        case 4:
            var fishEye = new FishEyeTransition()
            {
                nextScene       = sceneNum,
                duration        = 1.0f,
                size            = 0.08f,
                zoom            = 10.0f,
                colorSeparation = 3.0f
            };
            TransitionKit.instance.transitionWithDelegate(fishEye);
            break;
            //case 5:
            //	Debug.Log("mask to Scene ========================================== ");

            //	var mask = new ImageMaskTransition()
            //	{
            //		maskTexture = maskTexture,
            //		backgroundColor = Color.black,
            //		nextScene = sceneNum
            //	};
            //	TransitionKit.instance.transitionWithDelegate(mask);
            //	break;
        }
    }
Example #9
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Load the compiled map
            _map = Content.Load <TiledMap>("maps/Library");
            // Create the map renderer
            _mapRenderer = new TiledMapRenderer(GraphicsDevice, _map);

            foreach (var layer in _map.ObjectLayers)
            {
                if (layer.Name == "Arrivals")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "from-city")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;


                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            if (_player == null)
                            {
                                _player = _entityManager.AddEntity(new Jack(Content, _entityManager, this, objectPosition));
                            }
                            else
                            {
                                _entityManager.AddEntity(_player);
                                _player.EntityManager = _entityManager;
                            }

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.UP;
                        }
                    }
                }
                else if (layer.Name == "Walls")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        _entityManager.AddEntity(new Wall(objectPosition, objectSize));
                    }
                }
                else if (layer.Name == "Doors")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        var door = new Door(objectPosition, objectSize);
                        _entityManager.AddEntity(door);

                        door.OnTriggerStart(() =>
                        {
                            _player.Freeze();
                        });

                        if (obj.Name == "city")
                        {
                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Town(Game, HarvestMoon.Arrival.Library);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                    }
                }
                else if (layer.Name == "Interactables")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        if (obj.Type == "npc")
                        {
                            string objectMessage = "";

                            foreach (var property in obj.Properties)
                            {
                                if (property.Key.Contains("message"))
                                {
                                    objectMessage = HarvestMoon.Instance.Strings.Get(property.Value);
                                }
                            }

                            if (obj.Name == "anna")
                            {
                                _entityManager.AddEntity(new Anna(Content, objectPosition, objectSize));
                            }

                            if (obj.Name == "bee-anatomy")
                            {
                                _entityManager.AddEntity(new BeeAnatomyBookshelf(objectPosition,
                                                                                 objectSize,
                                                                                 "Useful info on bees' anatomy.",
                                                                                 "Bee anatomy"));
                            }

                            if (obj.Name == "bee-social")
                            {
                                _entityManager.AddEntity(new BeeSocialBookshelf(objectPosition,
                                                                                objectSize,
                                                                                "Useful info on bees' social structure.",
                                                                                "Bee social"));
                            }
                        }
                    }
                }
            }

            LoadPlayer();
        }
 public void cargar()
 {
     FadeTransition.FadeTo("gestor");
 }
Example #11
0
        public override void LoadContent()
        {
            base.LoadContent();

            if (MediaPlayer.State == MediaState.Stopped)
            {
                var song = Content.Load <Song>("audio/music/town");

                MediaPlayer.Play(song);
                MediaPlayer.IsRepeating = true;
            }


            // Load the compiled map
            _map = Content.Load <TiledMap>("maps/City");
            // Create the map renderer
            _mapRenderer = new TiledMapRenderer(GraphicsDevice, _map);

            foreach (var layer in _map.ObjectLayers)
            {
                if (layer.Name == "Arrivals")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "from-ranch" && _arrival == HarvestMoon.Arrival.Ranch)
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            _entityManager.AddEntity(_player);
                            _player.EntityManager = _entityManager;

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.UP;
                        }
                        else if (obj.Name == "from-library" && _arrival == HarvestMoon.Arrival.Library)
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;
                            _entityManager.AddEntity(_player);
                            _player.EntityManager = _entityManager;

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.DOWN;
                        }
                        else if (obj.Name == "from-librarian" && _arrival == HarvestMoon.Arrival.Librarian)
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            _entityManager.AddEntity(_player);
                            _player.EntityManager = _entityManager;

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.DOWN;
                        }
                        else if (obj.Name == "from-dealer" && _arrival == HarvestMoon.Arrival.Dealer)
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;
                            _entityManager.AddEntity(_player);
                            _player.EntityManager = _entityManager;

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.DOWN;
                        }
                        else if (obj.Name == "from-florist" && _arrival == HarvestMoon.Arrival.Florist)
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            _entityManager.AddEntity(_player);
                            _player.EntityManager = _entityManager;

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.DOWN;
                        }
                    }
                }
                else if (layer.Name == "Interactables")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Type == "npc")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            var objectSize = obj.Size;

                            string objectMessage = "";

                            foreach (var property in obj.Properties)
                            {
                                if (property.Key.Contains("message"))
                                {
                                    objectMessage = HarvestMoon.Instance.Strings.Get(property.Value);
                                }
                            }

                            if (obj.Name == "edd")
                            {
                                _entityManager.AddEntity(new Edd(Content, objectPosition, objectSize));
                            }
                            else if (obj.Name == "ted")
                            {
                                _entityManager.AddEntity(new Ted(Content, objectPosition, objectSize));
                            }
                            else if (obj.Name == "monica")
                            {
                                _entityManager.AddEntity(new Monica(Content, objectPosition, objectSize));
                            }
                            else
                            {
                                _entityManager.AddEntity(new BasicMessage(objectPosition, objectSize, objectMessage));
                            }
                        }
                    }
                }
                else if (layer.Name == "Doors")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        if (obj.Name == "ranch")
                        {
                            var door = new Door(objectPosition, objectSize);
                            _entityManager.AddEntity(door);

                            door.OnTriggerStart(() =>
                            {
                                _player.Freeze();
                            });


                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    this._mediaShouldFadeToRanch = true;
                                }
                            });
                        }
                        else if (obj.Name == "library")
                        {
                            var door = new RanchDoor(Content, objectPosition, objectSize);
                            _entityManager.AddEntity(door);

                            door.OnTriggerStart(() =>
                            {
                                _player.Freeze();
                            });

                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Library(Game);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                        else if (obj.Name == "librarian")
                        {
                            var door = new RanchDoor(Content, objectPosition, objectSize);
                            _entityManager.AddEntity(door);

                            door.OnTriggerStart(() =>
                            {
                                _player.Freeze();
                            });

                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Librarian(Game);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                        else if (obj.Name == "dealer")
                        {
                            var door = new RanchDoor(Content, objectPosition, objectSize);
                            _entityManager.AddEntity(door);

                            door.OnTriggerStart(() =>
                            {
                                _player.Freeze();
                            });

                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Dealer(Game);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                        else if (obj.Name == "florist")
                        {
                            var door = new RanchDoor(Content, objectPosition, objectSize);
                            _entityManager.AddEntity(door);

                            door.OnTriggerStart(() =>
                            {
                                _player.Freeze();
                            });

                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Florist(Game);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                    }
                }
                else if (layer.Name == "Walls")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        _entityManager.AddEntity(new Wall(objectPosition, objectSize));
                    }
                }
            }

            LoadPlayer();
        }
Example #12
0
        private void initSceneChnageTrigger()
        {
            var objectLayer        = tiledMap.getObjectGroup("Position");
            var cave1TriggerObject = objectLayer.objectWithName("cave1Trigger");
            var cave3TriggerObject = objectLayer.objectWithName("cave3Trigger");


            var cave1TriggerEntity = createEntity("cave1Trigger");

            cave1TriggerEntity.setPosition(cave1TriggerObject.position + new Vector2(cave1TriggerObject.width / 2, cave1TriggerObject.height / 2));
            cave1TriggerEntity.addComponent <FSRigidBody>()
            .setBodyType(BodyType.Dynamic);

            var cave1Trigger = cave1TriggerEntity.addComponent <SceneChangeTriggerComponent>();

            cave1Trigger.setSize(cave1TriggerObject.width, cave1TriggerObject.height);
            cave1Trigger.setIsSensor(true);
            cave1Trigger.setCollisionCategories(CollisionSetting.tiledObjectCategory);
            cave1Trigger.setCollidesWith(CollisionSetting.playerCategory);

            cave1Trigger.onAdded += () =>
            {
                cave1Trigger.GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var cave1      = new Cave1();
                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(cave1);
                        player.setPosition(230, 400);
                        return(cave1);
                    });

                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;

                    return(true);
                };
            };

            var cave3TriggerEntity = createEntity("cave3Trigger");

            cave3TriggerEntity.setPosition(cave3TriggerObject.position + new Vector2(cave3TriggerObject.width / 2, cave3TriggerObject.height / 2));
            cave3TriggerEntity.addComponent <FSRigidBody>()
            .setBodyType(BodyType.Dynamic);

            var cave3Trigger = cave3TriggerEntity.addComponent <SceneChangeTriggerComponent>();

            cave3Trigger.setSize(cave3TriggerObject.width, cave3TriggerObject.height);
            cave3Trigger.setIsSensor(true);
            cave3Trigger.setCollisionCategories(CollisionSetting.tiledObjectCategory);
            cave3Trigger.setCollidesWith(CollisionSetting.playerCategory);

            cave3Trigger.onAdded += () =>
            {
                cave3Trigger.GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var cave3 = new Cave3();

                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(cave3);
                        player.setPosition(215, 420);
                        return(cave3);
                    });

                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;

                    return(true);
                };
            };
        }
Example #13
0
 public WinScreenTemplate(SceneManager sceneManager, FadeTransition fadeTransition)
 {
     _sceneManager   = sceneManager;
     _fadeTransition = fadeTransition;
 }
Example #14
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (_mediaShouldFadeToRanch)
            {
                if (MediaPlayer.Volume > 0.0f && MediaPlayer.State == MediaState.Playing)
                {
                    MediaPlayer.Volume -= 0.1f;
                }

                if (MediaPlayer.Volume <= 0.0f)
                {
                    MediaPlayer.Stop();
                    MediaPlayer.Volume = 1.0f;

                    var screen     = new Ranch(Game, HarvestMoon.Arrival.Town);
                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                    ScreenManager.LoadScreen(screen, transition);
                }
            }


            // Update the map
            // map Should be the `TiledMap`
            _mapRenderer.Update(gameTime);
            _entityManager.Update(gameTime);


            if (_player != null && !_player.IsDestroyed)
            {
                _camera.LookAt(_player.Position);
                var constraints = new Vector2();

                if (_camera.BoundingRectangle.Center.X < 320)
                {
                    constraints.X = 320;
                }

                if (_camera.BoundingRectangle.Center.X > _map.Width * _map.TileWidth - 320)
                {
                    constraints.X = _map.Width * _map.TileWidth - 320;
                }

                if (_camera.BoundingRectangle.Center.Y < 240)
                {
                    constraints.Y = 240;
                }

                if (_camera.BoundingRectangle.Center.Y > _map.Height * _map.TileHeight - 240)
                {
                    constraints.Y = _map.Height * _map.TileHeight - 240;
                }

                if (constraints.X != 0)
                {
                    _camera.LookAt(new Vector2(constraints.X, _player.Position.Y));
                }

                if (constraints.Y != 0)
                {
                    _camera.LookAt(new Vector2(_player.Position.X, constraints.Y));
                }

                if (constraints.X != 0 && constraints.Y != 0)
                {
                    _camera.LookAt(new Vector2(constraints.X, constraints.Y));
                }
            }


            CheckCollisions();
        }
Example #15
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Load the compiled map
            _map = Content.Load <TiledMap>("maps/Barn");
            // Create the map renderer
            _mapRenderer = new TiledMapRenderer(GraphicsDevice, _map);

            foreach (var layer in _map.ObjectLayers)
            {
                if (layer.Name == "Arrivals")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "barn" && _arrival == HarvestMoon.Arrival.Ranch)
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            if (_player == null)
                            {
                                _player = _entityManager.AddEntity(new Jack(Content, _entityManager, this, objectPosition));
                            }
                            else
                            {
                                _entityManager.AddEntity(_player);
                                _player.EntityManager = _entityManager;
                            }

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.UP;
                        }
                    }
                }
                else if (layer.Name == "Doors")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        var door = new Door(objectPosition, objectSize);
                        _entityManager.AddEntity(door);

                        if (obj.Name == "ranch")
                        {
                            door.OnTriggerStart(() =>
                            {
                                _player.Freeze();
                            });

                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Ranch(Game, HarvestMoon.Arrival.Barn);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                    }
                }
                else if (layer.Name == "Walls")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        _entityManager.AddEntity(new Wall(objectPosition, objectSize));
                    }
                }
                else if (layer.Name == "Special")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        var    placementName   = obj.Name;
                        int    lastIndexOf     = placementName.LastIndexOf("-");
                        string specialName     = placementName.Substring(0, lastIndexOf);
                        string specialPosition = placementName.Substring(lastIndexOf + 1, placementName.Length - specialName.Length - 1);

                        var cowPlacement = new CowPlacement();
                        cowPlacement.Position = objectPosition;
                        cowPlacement.Size     = objectSize;

                        _cowPlacements[int.Parse(specialPosition)] = cowPlacement;
                    }
                }
                else if (layer.Name == "Interactables")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "fooder")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            var objectSize = obj.Size;

                            _entityManager.AddEntity(new FooderBin(_player, Content, objectPosition, objectSize));
                        }
                    }
                }
            }

            for (int i = 0; i < _cowPlacements.Count; ++i)
            {
                var fooder = _entityManager.AddEntity(new Fooder(_player, Content, _cowPlacements[i].Position, _cowPlacements[i].Size));
                fooder.Index = i;

                fooder.Feed(HarvestMoon.Instance.CowFooderList[i]);
            }

            foreach (var kvp in HarvestMoon.Instance.CowNameIndexDictionary)
            {
                var i   = kvp.Value;
                var cow = _entityManager.AddEntity(new Cow(_player, Content, _cowPlacements[i].Position, _cowPlacements[i].Size));
                cow.Index = i;
            }



            LoadPlayer();
        }
Example #16
0
 public GameplayStage()
 {
     this.BackgroundColor = BackgroundColor = Color.Black;
     this.InTransition    = FadeTransition.Out();
     this.OutTransition   = FadeTransition.In();
 }
Example #17
0
        public void Activate()
        {
            Window  window     = NUIApplication.GetDefaultWindow();
            Vector2 windowSize = new Vector2((float)(window.Size.Width), (float)(window.Size.Height));

            magnification = Math.Min(windowSize.X / baseSize.X, windowSize.Y / baseSize.Y);
            contentSize   = baseSize * magnification;

            navigator = new Navigator()
            {
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                HeightResizePolicy = ResizePolicyType.FillToParent,
                Transition         = new Transition()
                {
                    TimePeriod    = new TimePeriod(400),
                    AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOutSine),
                },
            };
            window.Add(navigator);

            View mainRoot = new View()
            {
                WidthResizePolicy  = ResizePolicyType.FillToParent,
                HeightResizePolicy = ResizePolicyType.FillToParent
            };

            View layoutView = new View()
            {
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.BottomCenter,
                ParentOrigin           = ParentOrigin.BottomCenter,
                Layout = new LinearLayout()
                {
                    LinearAlignment   = LinearLayout.Alignment.Center,
                    LinearOrientation = LinearLayout.Orientation.Horizontal,
                    CellPadding       = new Size(convertSize(60), convertSize(60)),
                },
                Position = new Position(0, -convertSize(30))
            };

            mainRoot.Add(layoutView);

            View redButton   = CreateButton(TileColor[0], Keywords[0, 0], Keywords[0, 1], redPage);
            View greenButton = CreateButton(TileColor[1], Keywords[1, 0], Keywords[1, 1], greenPage);
            View blueButton  = CreateButton(TileColor[2], Keywords[2, 0], Keywords[2, 1], bluePage);

            layoutView.Add(redButton);
            layoutView.Add(greenButton);
            layoutView.Add(blueButton);


            TransitionGroup transitionGroup = new TransitionGroup()
            {
                UseGroupTimePeriod    = true,
                UseGroupAlphaFunction = true,
                StepTransition        = true,
                TimePeriod            = new TimePeriod(500, 3000),
                AlphaFunction         = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseInOut),
            };
            SlideTransition slide = new SlideTransition()
            {
                TimePeriod    = new TimePeriod(1000),
                AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
                Direction     = SlideTransitionDirection.Top
            };

            transitionGroup.AddTransition(slide);
            FadeTransition fade = new FadeTransition()
            {
                Opacity       = 0.3f,
                TimePeriod    = new TimePeriod(1000),
                AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default)
            };

            transitionGroup.AddTransition(fade);
            ScaleTransition scale = new ScaleTransition()
            {
                ScaleFactor   = new Vector2(0.3f, 0.3f),
                TimePeriod    = new TimePeriod(1000),
                AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default)
            };

            transitionGroup.AddTransition(scale);

            mainPage = new ContentPage()
            {
                BackgroundColor        = Color.Transparent,
                Content                = mainRoot,
                DisappearingTransition = new ScaleTransition()
                {
                    TimePeriod    = new TimePeriod(500),
                    AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
                    ScaleFactor   = new Vector2(0.5f, 1.5f)
                },
                AppearingTransition = transitionGroup,
            };
            navigator.Push(mainPage);

            View totalGreyView = new View()
            {
                Size              = new Size(convertSize(50), convertSize(50)),
                CornerRadius      = convertSize(25),
                BackgroundColor   = ColorGrey,
                TransitionOptions = new TransitionOptions()
                {
                    TransitionTag = totalGreyTag,
                }
            };

            totalGreyView.TouchEvent += (object sender, View.TouchEventArgs e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Down)
                {
                    navigator.PushWithTransition(totalPage);
                }
                return(true);
            };
            layoutView.Add(totalGreyView);


            // ------------------------------------------------------


            View totalPageRoot = new View()
            {
                WidthResizePolicy = ResizePolicyType.FillToParent,
                SizeHeight        = contentSize.Height,
            };

            View totalLayoutView = new View()
            {
                Layout = new GridLayout()
                {
                    Rows            = 2,
                    GridOrientation = GridLayout.Orientation.Vertical,
                },
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.Center,
                ParentOrigin           = ParentOrigin.Center,
            };

            totalPageRoot.Add(totalLayoutView);

            for (int i = 0; i < 3; ++i)
            {
                View sizeView = new View()
                {
                    Size = new Size(contentSize.Width / 2.0f, contentSize.Height / 2.0f),
                };
                View smallView = CreatePageScene(TileColor[i], Keywords[i, 0], Keywords[i, 1]);
                smallView.Scale = new Vector3(0.45f, 0.45f, 1.0f);
                smallView.PositionUsesPivotPoint = true;
                smallView.PivotPoint             = PivotPoint.Center;
                smallView.ParentOrigin           = ParentOrigin.Center;
                sizeView.Add(smallView);
                totalLayoutView.Add(sizeView);
            }

            View sizeGreyView = new View()
            {
                Size = new Size(contentSize.Width / 2.0f, contentSize.Height / 2.0f),
            };

            View totalGreyReturnView = new View()
            {
                PositionUsesPivotPoint = true,
                PivotPoint             = PivotPoint.Center,
                ParentOrigin           = ParentOrigin.Center,
                Size              = new Size(convertSize(70), convertSize(70)),
                CornerRadius      = convertSize(20),
                BackgroundColor   = ColorGrey,
                TransitionOptions = new TransitionOptions()
                {
                    TransitionTag = totalGreyTag,
                }
            };

            sizeGreyView.Add(totalGreyReturnView);
            totalLayoutView.Add(sizeGreyView);

            totalGreyReturnView.TouchEvent += (object sender, View.TouchEventArgs e) =>
            {
                if (e.Touch.GetState(0) == PointStateType.Down)
                {
                    navigator.PopWithTransition();
                }
                return(true);
            };

            totalPage = new ContentPage()
            {
                BackgroundColor     = Color.Transparent,
                Content             = totalPageRoot,
                AppearingTransition = new FadeTransition()
                {
                    TimePeriod    = new TimePeriod(500),
                    AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
                },
                DisappearingTransition = new FadeTransition()
                {
                    TimePeriod    = new TimePeriod(500),
                    AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Default),
                },
            };
        }
 public static void GameOver()
 {
     FadeTransition.FadeTo("gameover");
 }
Example #19
0
 private int _fadeDirection = -1; // in -> -1, out -> 1
 // Use this for initialization
 void Start()
 {
     instance = this;
 }
Example #20
0
    void Start()
    {
        LevelNumber.text = (SceneNumber + 1).ToString();
        if(SceneNumber == 0)
        {
            fade = gameObject.GetComponent<FadeTransition>();
            Debug.Log("Start");
            stateMethod = new FState(WaitForPlayButton);
            fade.Sprite.gameObject.SetActive(true);
            fade.ImmediateOpaque();

            stateMethod = new FState(WaitForPlayButton);
            DisplayStartMenu();
        }
        if(SceneNumber >= 1 && SceneNumber != 4)
        {
            Debug.Log("Start scene 2 - 3");
            stateMethod = new FState(WaitForPlayButton);
            fade.ImmediateOpaque();

            Application.LoadLevel(SceneNumber);
            //DisplayLevelMenu();
        }
        if(SceneNumber == 4)
        {
            Debug.Log("Start scene 4");
            fade.ImmediateOpaque();
            EndGameMenu.SetActive(true);
        }
    }
Example #21
0
        public override Widget build(BuildContext context)
        {
            MediaQueryData mediaQueryData = MediaQuery.of(context);

            D.assert(widget.animation != null);
            ThemeData         theme         = Theme.of(context);
            ColorScheme       colorScheme   = theme.colorScheme;
            SnackBarThemeData snackBarTheme = theme.snackBarTheme;
            bool isThemeDark = theme.brightness == Brightness.dark;

            Brightness brightness           = isThemeDark ? Brightness.light : Brightness.dark;
            Color      themeBackgroundColor = isThemeDark
                ? colorScheme.onSurface
                : Color.alphaBlend(colorScheme.onSurface.withOpacity(0.80f), colorScheme.surface);
            ThemeData inverseTheme = new ThemeData(
                brightness: brightness,
                backgroundColor: themeBackgroundColor,
                colorScheme: new ColorScheme(
                    primary: colorScheme.onPrimary,
                    primaryVariant: colorScheme.onPrimary,
                    secondary: isThemeDark ? colorScheme.primaryVariant : colorScheme.secondary,
                    secondaryVariant: colorScheme.onSecondary,
                    surface: colorScheme.onSurface,
                    background: themeBackgroundColor,
                    error: colorScheme.onError,
                    onPrimary: colorScheme.primary,
                    onSecondary: colorScheme.secondary,
                    onSurface: colorScheme.surface,
                    onBackground: colorScheme.background,
                    onError: colorScheme.error,
                    brightness: brightness
                    ),
                snackBarTheme: snackBarTheme
                );

            TextStyle        contentTextStyle   = snackBarTheme.contentTextStyle ?? inverseTheme.textTheme.subtitle1;
            SnackBarBehavior snackBarBehavior   = widget.behavior ?? snackBarTheme.behavior ?? SnackBarBehavior.fix;
            bool             isFloatingSnackBar = snackBarBehavior == SnackBarBehavior.floating;
            float            snackBarPadding    = isFloatingSnackBar ? 16.0f : 24.0f;

            CurvedAnimation heightAnimation =
                new CurvedAnimation(parent: widget.animation, curve: SnackBarUtils._snackBarHeightCurve);
            CurvedAnimation fadeInAnimation =
                new CurvedAnimation(parent: widget.animation, curve: SnackBarUtils._snackBarFadeInCurve);
            CurvedAnimation fadeOutAnimation = new CurvedAnimation(
                parent: widget.animation,
                curve: SnackBarUtils._snackBarFadeOutCurve,
                reverseCurve: new Threshold(0.0f)
                );

            var childrenList = new List <Widget>()
            {
                new SizedBox(width: snackBarPadding),
                new Expanded(
                    child: new Container(
                        padding: EdgeInsets.symmetric(vertical: SnackBarUtils._singleLineVerticalPadding),
                        child: new DefaultTextStyle(
                            style: contentTextStyle,
                            child: widget.content
                            )
                        )
                    )
            };

            if (widget.action != null)
            {
                childrenList.Add(new ButtonTheme(
                                     textTheme: ButtonTextTheme.accent,
                                     minWidth: 64.0f,
                                     padding: EdgeInsets.symmetric(horizontal: snackBarPadding),
                                     child: widget.action
                                     ));
            }
            else
            {
                childrenList.Add(new SizedBox(width: snackBarPadding));
            }

            Widget snackBar = new SafeArea(
                top: false,
                bottom: !isFloatingSnackBar,
                child: new Row(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: childrenList
                    )
                );

            float elevation       = widget.elevation ?? snackBarTheme.elevation ?? 6.0f;
            Color backgroundColor =
                widget.backgroundColor ?? snackBarTheme.backgroundColor ?? inverseTheme.backgroundColor;
            ShapeBorder shape = widget.shape
                                ?? snackBarTheme.shape
                                ?? (isFloatingSnackBar
                                    ? new RoundedRectangleBorder(borderRadius: BorderRadius.circular(4.0f))
                                    : null);

            snackBar = new Material(
                shape: shape,
                elevation: elevation,
                color: backgroundColor,
                child: new Theme(
                    data: inverseTheme,
                    child: mediaQueryData.accessibleNavigation
                        ? snackBar
                        : new FadeTransition(
                        opacity: fadeOutAnimation,
                        child: snackBar
                        )
                    )
                );

            if (isFloatingSnackBar)
            {
                snackBar = new Padding(
                    padding: EdgeInsets.fromLTRB(15.0f, 5.0f, 15.0f, 10.0f),
                    child: snackBar
                    );
            }

            snackBar = new Dismissible(
                key: Key.key("dismissible"),
                direction: DismissDirection.down,
                resizeDuration: null,
                onDismissed: (DismissDirection? direction) => {
                Scaffold.of(context).removeCurrentSnackBar(reason: SnackBarClosedReason.swipe);
            },
                child: snackBar
                );

            Widget snackBarTransition = null;

            if (mediaQueryData.accessibleNavigation)
            {
                snackBarTransition = snackBar;
            }
            else if (isFloatingSnackBar)
            {
                snackBarTransition = new FadeTransition(
                    opacity: fadeInAnimation,
                    child: snackBar
                    );
            }
            else
            {
                snackBarTransition = new AnimatedBuilder(
                    animation: heightAnimation,
                    builder: (BuildContext subContext, Widget subChild) => {
                    return(new Align(
                               alignment: AlignmentDirectional.topStart,
                               heightFactor: heightAnimation.value,
                               child: subChild
                               ));
                },
                    child: snackBar
                    );
            }

            return(new ClipRect(child: snackBarTransition));
        }
Example #22
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Load the compiled map
            _map = Content.Load <TiledMap>("maps/Librarian");
            // Create the map renderer
            _mapRenderer = new TiledMapRenderer(GraphicsDevice, _map);

            foreach (var layer in _map.ObjectLayers)
            {
                if (layer.Name == "Arrivals")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "from-city")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;


                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            if (_player == null)
                            {
                                _player = _entityManager.AddEntity(new Jack(Content, _entityManager, this, objectPosition));
                            }
                            else
                            {
                                _entityManager.AddEntity(_player);
                                _player.EntityManager = _entityManager;
                            }

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.UP;
                        }
                    }
                }
                else if (layer.Name == "Walls")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        _entityManager.AddEntity(new Wall(objectPosition, objectSize));
                    }
                }
                else if (layer.Name == "Doors")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        var door = new Door(objectPosition, objectSize);
                        _entityManager.AddEntity(door);

                        door.OnTriggerStart(() =>
                        {
                            _player.Freeze();
                        });

                        if (obj.Name == "city")
                        {
                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Town(Game, HarvestMoon.Arrival.Librarian);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                    }
                }
                else if (layer.Name == "Interactables")
                {
                    foreach (var obj in layer.Objects)
                    {
                    }
                }
            }

            LoadPlayer();
        }
Example #23
0
        private void initSceneChangeTrigger()
        {
            var objectLayer      = tiledMap.getObjectGroup("Object");
            var outTriggerObject = objectLayer.objectWithName("outTrigger");
            var mazeTirgger      = objectLayer.objectWithName("maze1Trigger");


            var outEntity = createSceneTrigger(outTriggerObject);

            outEntity.getComponent <SceneChangeTriggerComponent>().onAdded += () =>
            {
                outEntity.getComponent <SceneChangeTriggerComponent>().GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var area       = new DongZhuangMazeArea();
                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(area);
                        player.setPosition(105, 145);
                        return(area);
                    });
                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;
                    return(true);
                };
            };

            var mazeEntity = createSceneTrigger(mazeTirgger);

            mazeEntity.getComponent <SceneChangeTriggerComponent>().onAdded += () =>
            {
                mazeEntity.getComponent <SceneChangeTriggerComponent>().GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var area       = new Maze01();
                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(area);
                        player.setPosition(150, 280);
                        return(area);
                    });
                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;
                    return(true);
                };
            };
            //var outEntity = createEntity("outEntity").setPosition(outTriggerObject.position+new Vector2(outTriggerObject.width/2f,outTriggerObject.height/2f));
            //outEntity.addComponent<FSRigidBody>()
            //    .setBodyType(BodyType.Dynamic);

            //var outTrigger = outEntity.addComponent<SceneChangeTriggerComponent>();
            //outTrigger.setSize(outTriggerObject.width, outTriggerObject.height);
            //outTrigger.setIsSensor(true);
            //outTrigger.setCollisionCategories(CollisionSetting.tiledObjectCategory);
            //outTrigger.setCollidesWith(CollisionSetting.playerCategory);

            //outTrigger.onAdded += ()=>{

            //};
        }
Example #24
0
    public void pressEnter()
    {
        if (ViewController._gameState._state == GameState.States.MAINSCENE && this._mainSceneCanvas.activeInHierarchy && this._canPressEnter)
        {
            this._canPressEnter = false;
            this._soundController.playSound(0);
            ViewController._gameState._state = GameState.States.GARAGE;
            this.GetComponent <AnimationController>().stopAnimations(GameState.States.MAINSCENE);

            if (PlayerPrefs.GetInt("GameComplete") == 0 || !GlobalVariables._iconStagesAdded)
            {
                addIconStagesGroup();
                GlobalVariables._iconStagesAdded = true;
            }

            var fader = new FadeTransition()
            {
                fadedDelay  = 0.7f,
                fadeToColor = Color.black
            };
            TransitionKit.instance.transitionWithDelegate(fader);

            Invoke("updateView", 0.7f);
        }

        else if (ViewController._gameState._state == GameState.States.GARAGE && this._canPressEnter)
        {
            this._soundController.playSound(0);
            this.gameObject.GetComponent <CountGarageController>().stopCoroutine();
            ViewController._gameState._state = GameState.States.GAMESCENE;
            this._garageSceneCanvas.SetActive(false);
            updateView();
        }

        else if (ViewController._gameState._state == GameState.States.GAMESCENE)
        {
            this._gameSceneCanvas.SetActive(false);
            this._gameObjectsGameScene.SetActive(false);


            if (GlobalVariables._currentLifes == 0 && GlobalVariables._globalLifes == 0)
            {
                resetGameInstances();
                ViewController._gameState._state = GameState.States.GAMEOVER;
            }

            else if (GlobalVariables._currentLifes == 0 && GlobalVariables._globalLifes != 0)
            {
                resetGameInstances();
                ViewController._gameState._state = GameState.States.GARAGE;
            }

            else
            {
                //Jugador Logra completar la etapa seleccionada
                if (GlobalVariables._userLevel == GlobalVariables._currentLevel && GlobalVariables._currentLevel != GlobalVariables._totallyStages)
                {
                    GlobalVariables._currentLevel++;
                    if (GlobalVariables._currentLevel > PlayerPrefs.GetInt("lastStageCompleted") && GlobalVariables._currentLevel != GlobalVariables._totallyStages)
                    {
                        PlayerPrefs.SetInt("lastStageCompleted", GlobalVariables._currentLevel);
                        print(PlayerPrefs.GetInt("lastStageCompleted"));
                    }
                }

                if (GlobalVariables._currentLevel == GlobalVariables._totallyStages)
                {
                    print("Aparecer escena final");
                    GlobalVariables._currentLevel    = 0;
                    GlobalVariables._userLevel       = 0;
                    ViewController._gameState._state = GameState.States.FINALSCENE;
                    this._iconStageGroup.transform.GetChild(_iconStageGroup.transform.childCount - 1).gameObject.GetComponent <Image>().color = this._stageCompleted;
                    this._iconStageGroup.GetChild(_iconStageGroup.transform.childCount - 1).transform.localScale = new Vector2(1f, 1f);
                }

                else
                {
                    resetGameInstances();
                    ViewController._gameState._state = GameState.States.GARAGE;
                    updateIconStageGroup();
                }

                GlobalVariables._userLevel = GlobalVariables._currentLevel;
            }

            updateView();
        }

        else if (ViewController._gameState._state == GameState.States.FINALSCENE)
        {
            this._soundController.GetComponent <AudioSource>().Stop();
            this._finalSceneCanvas.SetActive(false);
            this._gameObjectsFinalView.SetActive(false);

            ViewController._gameState._state = GameState.States.MAINSCENE;
            PlayerPrefs.SetInt("GameComplete", 1);
            resetGame();

            updateView();
        }

        else if (ViewController._gameState._state == GameState.States.GAMEOVER)
        {
            this._gameOverSceneCanvas.SetActive(false);
            ViewController._gameState._state = GameState.States.MAINSCENE;

            // GlobalVariables._gameComplete = false;
            resetGame();

            updateView();
        }
    }
Example #25
0
        public override void OnInitialise()
        {
            base.OnInitialise();

            GUIManager guiManager = SystemCore.GetSubsystem <GUIManager>();

            //panel
            p = new Panel(new Rectangle(0, 0, GUIManager.ScreenRatioX(0.1f), GUIManager.ScreenRatioY(0.1f)), GUITexture.Textures["blank"]);
            p.HighlightAlpha = 0.3f;
            p.MainColor      = SystemCore.ActiveColorScheme.Color4;
            p.Anchor(AnchorPoint.middle, GUIManager.ScreenPoint.midpoint, new Vector2(0, 0));
            guiManager.AddControl(p);



            //button
            Button b = new Button(new Rectangle(0, 0, GUIManager.ScreenRatioX(0.1f), GUIManager.ScreenRatioY(0.05f)), GUITexture.Textures["blank"]);

            b.HighlightAlpha = 0.4f;
            b.MainColor      = SystemCore.ActiveColorScheme.Color3;
            b.HighlightColor = SystemCore.ActiveColorScheme.Color4;
            b.Anchor(AnchorPoint.topMid, GUIManager.ScreenPoint.topMiddle, Vector2.Zero);
            guiManager.AddControl(b);



            //label attached to button
            Label l = new Label(GUIFonts.Fonts["test"], "Button");

            l.TextOutline = false;
            l.TextColor   = SystemCore.ActiveColorScheme.Color1;
            b.AttachLabel(l);



            //bordered button
            Button c = new Button(new Rectangle(700, 10, 100, 40), GUITexture.Textures["blank"]);

            c.MainAlpha       = 0.4f;
            c.MainColor       = SystemCore.ActiveColorScheme.Color3;
            c.HighlightColor  = SystemCore.ActiveColorScheme.Color4;
            c.Border          = true;
            c.BorderColor     = SystemCore.ActiveColorScheme.Color5;
            c.BorderThickness = 1;
            guiManager.AddControl(c);


            FadeTransition fadeTest = new FadeTransition(1, 0, 500, 5000);

            p.ApplyTransition(fadeTest);

            //needs work
            ListBox listBox = new ListBox(new Rectangle(200, 200, 200, 200), GUITexture.Textures["blank"]);

            for (int i = 0; i < 100; i++)
            {
                listBox.AddItem(i.ToString());
            }
            guiManager.AddControl(listBox);

            //f****d
            ItemCarousel itemCarousel = new ItemCarousel(new Vector2(700, 500), true, 50, 50);

            for (int i = 0; i < 5; i++)
            {
                itemCarousel.Add(GUITexture.Textures["blank"], i.ToString());
            }
            guiManager.AddControl(itemCarousel);



            SetCameraMovement(false);
        }
Example #26
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Load the compiled map
            _map = Content.Load <TiledMap>("maps/Florist");
            // Create the map renderer
            _mapRenderer = new TiledMapRenderer(GraphicsDevice, _map);

            foreach (var layer in _map.ObjectLayers)
            {
                if (layer.Name == "Arrivals")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "from-city")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;


                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            if (_player == null)
                            {
                                _player = _entityManager.AddEntity(new Jack(Content, _entityManager, this, objectPosition));
                            }
                            else
                            {
                                _entityManager.AddEntity(_player);
                                _player.EntityManager = _entityManager;
                            }

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.PlayerFacing = Jack.Facing.UP;
                        }
                    }
                }
                else if (layer.Name == "Walls")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        _entityManager.AddEntity(new Wall(objectPosition, objectSize));
                    }
                }
                else if (layer.Name == "Doors")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        var door = new Door(objectPosition, objectSize);
                        _entityManager.AddEntity(door);

                        door.OnTriggerStart(() =>
                        {
                            _player.Freeze();
                        });

                        if (obj.Name == "city")
                        {
                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new Town(Game, HarvestMoon.Arrival.Florist);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                    }
                }
                else if (layer.Name == "Interactables")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        string objectMessage = "";

                        foreach (var property in obj.Properties)
                        {
                            if (property.Key.Contains("message"))
                            {
                                objectMessage = HarvestMoon.Instance.Strings.Get(property.Value);
                            }
                        }

                        if (obj.Name == "shop")
                        {
                            _entityManager.AddEntity(new FloristStore(objectPosition,
                                                                      objectSize,
                                                                      "All purchases will be delivered the same day.",
                                                                      "Florist"));
                        }
                        else if (obj.Name == "george")
                        {
                            _entityManager.AddEntity(new George(Content, objectPosition, objectSize));
                        }
                    }
                }
            }

            LoadPlayer();
        }
Example #27
0
 public void GroupToLevel()
 {
     StartCoroutine(MoveLeftOff(2, 5, Menu.goToLevel, null, null));
     fadeAction      = TurnOnLoading;
     afterFadeAction = LobbyToLevel;
 }
Example #28
0
        private void initSceneChangeTrigger()
        {
            var objectLayer = tiledMap.getObjectGroup("Object");

            var maze0Object = objectLayer.objectWithName("maze0");
            var maze2Object = objectLayer.objectWithName("maze2");
            var maze4Object = objectLayer.objectWithName("maze4");

            var maze0 = createSceneTrigger(maze0Object);

            maze0.getComponent <SceneChangeTriggerComponent>().onAdded += () =>
            {
                maze0.getComponent <SceneChangeTriggerComponent>().GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var area       = new Maze0();
                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(area);
                        player.setPosition(152, 52);
                        return(area);
                    });
                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;
                    return(true);
                };
            };

            var maze2 = createSceneTrigger(maze2Object);

            maze2.getComponent <SceneChangeTriggerComponent>().onAdded += () =>
            {
                maze2.getComponent <SceneChangeTriggerComponent>().GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var area       = new Maze02();
                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(area);
                        player.setPosition(152, 280);
                        return(area);
                    });
                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;
                    return(true);
                };
            };

            var maze4 = createSceneTrigger(maze4Object);

            maze4.getComponent <SceneChangeTriggerComponent>().onAdded += () =>
            {
                maze4.getComponent <SceneChangeTriggerComponent>().GetFixture().onCollision += (fixtureA, fixtureB, contact) =>
                {
                    var area       = new Maze04();
                    var transition = new FadeTransition(() =>
                    {
                        player.detachFromScene();
                        player.attachToScene(area);
                        player.setPosition(23, 165);
                        return(area);
                    });
                    transition.onTransitionCompleted += () =>
                    {
                        GameSetting.isGamePause = false;
                    };
                    Core.startSceneTransition(transition);

                    GameSetting.isGamePause = true;
                    return(true);
                };
            };
        }
Example #29
0
        public override void LoadContent()
        {
            base.LoadContent();

            // Load the compiled map
            _map = Content.Load <TiledMap>("maps/ToolsRoom");
            // Create the map renderer
            _mapRenderer = new TiledMapRenderer(GraphicsDevice, _map);

            foreach (var layer in _map.ObjectLayers)
            {
                if (layer.Name == "Arrivals")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Name == "from-house")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;


                            _player = HarvestMoon.Instance.RanchState.Entities.FirstOrDefault(e => e is Jack) as Jack;

                            if (_player == null)
                            {
                                _player = _entityManager.AddEntity(new Jack(Content, _entityManager, this, objectPosition));
                            }
                            else
                            {
                                _entityManager.AddEntity(_player);
                                _player.EntityManager = _entityManager;
                            }

                            _player.Position = new Vector2(objectPosition.X, objectPosition.Y);

                            _player.OnPack((toolName) =>
                            {
                                PackTool(toolName);
                            });

                            _player.PlayerFacing = Jack.Facing.RIGHT;
                        }
                    }
                }
                else if (layer.Name == "Walls")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        _entityManager.AddEntity(new Wall(objectPosition, objectSize));
                    }
                }
                else if (layer.Name == "Doors")
                {
                    foreach (var obj in layer.Objects)
                    {
                        var objectPosition = obj.Position;

                        objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                        objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                        var objectSize = obj.Size;

                        var door = new Door(objectPosition, objectSize);
                        _entityManager.AddEntity(door);

                        door.OnTriggerStart(() =>
                        {
                            _player.Freeze();
                        });

                        if (obj.Name == "house")
                        {
                            door.OnTriggerEnd(() =>
                            {
                                if (!door.Triggered)
                                {
                                    door.Triggered = true;
                                    var screen     = new House(Game, HarvestMoon.Arrival.Tools);
                                    var transition = new FadeTransition(GraphicsDevice, Color.Black, 1.0f);
                                    ScreenManager.LoadScreen(screen, transition);
                                }
                            });
                        }
                    }
                }
                else if (layer.Name == "Interactables")
                {
                    foreach (var obj in layer.Objects)
                    {
                        if (obj.Type == "npc")
                        {
                            var objectPosition = obj.Position;

                            objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                            objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                            var objectSize = obj.Size;

                            string objectMessage = "";

                            foreach (var property in obj.Properties)
                            {
                                if (property.Key.Contains("message"))
                                {
                                    objectMessage = HarvestMoon.Instance.Strings.Get(property.Value);
                                }
                            }

                            if (obj.Name == "how-to")
                            {
                                _entityManager.AddEntity(new HouseBookshelf(objectPosition,
                                                                            objectSize,
                                                                            "Instructions using the tools.",
                                                                            "How-To"));
                            }
                        }
                        else if (obj.Type == "tool")
                        {
                            if (obj.Name == "sickle")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new Sickle(Content, objectPosition));
                            }

                            if (obj.Name == "hoe")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new Hoe(Content, objectPosition));
                            }

                            if (obj.Name == "hammer")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new Hammer(Content, objectPosition));
                            }

                            if (obj.Name == "axe")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new Axe(Content, objectPosition));
                            }

                            if (obj.Name == "watering-can")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new WateringCan(Content, objectPosition));
                            }

                            if (obj.Name == "grass-seeds")
                            {
                                if (HarvestMoon.Instance.GrassSeeds > 0)
                                {
                                    var objectPosition = obj.Position;

                                    objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                    objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                    _entityManager.AddEntity(new GrassSeeds(Content, objectPosition)); //Not working yet
                                }
                            }

                            if (obj.Name == "turnip-seeds")
                            {
                                if (HarvestMoon.Instance.TurnipSeeds > 0)
                                {
                                    var objectPosition = obj.Position;

                                    objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                    objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                    _entityManager.AddEntity(new TurnipSeeds(Content, objectPosition));
                                }
                            }


                            if (obj.Name == "potato-seeds")
                            {
                                if (HarvestMoon.Instance.PotatoSeeds > 0)
                                {
                                    var objectPosition = obj.Position;

                                    objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                    objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                    _entityManager.AddEntity(new PotatoSeeds(Content, objectPosition));
                                }
                            }

                            if (obj.Name == "corn-seeds")
                            {
                                if (HarvestMoon.Instance.CornSeeds > 0)
                                {
                                    var objectPosition = obj.Position;

                                    objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                    objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                    _entityManager.AddEntity(new CornSeeds(Content, objectPosition));
                                }
                            }

                            if (obj.Name == "tomato-seeds")
                            {
                                if (HarvestMoon.Instance.TomatoSeeds > 0)
                                {
                                    var objectPosition = obj.Position;

                                    objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                    objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                    _entityManager.AddEntity(new TomatoSeeds(Content, objectPosition));
                                }
                            }

                            if (obj.Name == "milker")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new Milker(Content, objectPosition));
                            }

                            if (obj.Name == "sword")
                            {
                                var objectPosition = obj.Position;

                                objectPosition.X = obj.Position.X + obj.Size.Width * 0.5f;
                                objectPosition.Y = obj.Position.Y + obj.Size.Height * 0.5f;

                                _entityManager.AddEntity(new Sword(Content, objectPosition));
                            }
                        }
                    }
                }
            }

            LoadPlayer();

            var tools = _entityManager.Entities.Where(e => e is Tool).Cast <Tool>().ToArray();

            var hm = Game as HarvestMoon;

            foreach (var tool in tools)
            {
                if (hm.IsToolPacked(tool.Name))
                {
                    tool.Hide();
                }
            }
        }
Example #30
0
	void OnGUI()
	{
		// hide the UI during transitions
		if( !_isUiVisible )
			return;

		if( Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android )
		{
			// bigger buttons for higher res mobile devices
			if( Screen.width >= 1500 || Screen.height >= 1500 )
				GUI.skin.button.fixedHeight = 60;
		}

		if( GUILayout.Button( "Fade to Scene" ) )
		{
			var fader = new FadeTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				fadedDelay = 0.2f,
				fadeToColor = Color.black
			};
			TransitionKit.instance.transitionWithDelegate( fader );
		}


		if( GUILayout.Button( "Vertical Slices to Scene" ) )
		{
			var slices = new VerticalSlicesTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				divisions = Random.Range( 3, 20 )
			};
			TransitionKit.instance.transitionWithDelegate( slices );
		}


		if( GUILayout.Button( "Triangle Slices to Scene" ) )
		{
			var slices = new TriangleSlicesTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				divisions = Random.Range( 2, 10 )
			};
			TransitionKit.instance.transitionWithDelegate( slices );
		}


		if( GUILayout.Button( "Pixelate to Scene with Random Scale Effect" ) )
		{
			var enumValues = System.Enum.GetValues( typeof( PixelateTransition.PixelateFinalScaleEffect ) );
			var randomScaleEffect = (PixelateTransition.PixelateFinalScaleEffect)enumValues.GetValue( Random.Range( 0, enumValues.Length ) );

			var pixelater = new PixelateTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				finalScaleEffect = randomScaleEffect,
				duration = 1.0f
			};
			TransitionKit.instance.transitionWithDelegate( pixelater );
		}


		if( GUILayout.Button( "Twirl via Component with No Scene Change" ) )
		{
			TransitionKit.instance.transitionWithDelegate( GetComponent<TwirlTransition>() );
		}


		if( GUILayout.Button( "Blur to Scene" ) )
		{
			var blur = new BlurTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				blurMax = 0.01f
			};
			TransitionKit.instance.transitionWithDelegate( blur );
		}


		if( GUILayout.Button( "Wacky Blur with No Scene Change" ) )
		{
			var blur = new BlurTransition()
			{
				duration = 1.0f,
				blurMax = 1f
			};
			TransitionKit.instance.transitionWithDelegate( blur );
		}


		if( GUILayout.Button( "Big Squares to Scene" ) )
		{
			var squares = new SquaresTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				squareSize = new Vector2( 5f, 4f ),
				smoothness = 0.0f
			};
			TransitionKit.instance.transitionWithDelegate( squares );
		}


		if( GUILayout.Button( "Little Squares to Scene" ) )
		{
			var squares = new SquaresTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				squareSize = new Vector2( 64f, 45f ),
				squareColor = Color.yellow,
				smoothness = 0.1f
			};
			TransitionKit.instance.transitionWithDelegate( squares );
		}


		if( GUILayout.Button( "Ripples to Scene" ) )
		{
			var ripple = new RippleTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				amplitude = 1500f,
				speed = 20f
			};
			TransitionKit.instance.transitionWithDelegate( ripple );
		}


		if( GUILayout.Button( "Fish Eye to Scene" ) )
		{
			var fishEye = new FishEyeTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				size = 0.08f,
				zoom = 10.0f,
				colorSeparation = 3.0f
			};
			TransitionKit.instance.transitionWithDelegate( fishEye );
		}


		if( GUILayout.Button( "Fish Eye (alternate params) to Scene" ) )
		{
			var fishEye = new FishEyeTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 2.0f,
				size = 0.2f,
				zoom = 100.0f,
				colorSeparation = 0.1f
			};
			TransitionKit.instance.transitionWithDelegate( fishEye );
		}


		if( GUILayout.Button( "Doorway to Scene" ) )
		{
			var doorway = new DoorwayTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				perspective = 1.5f,
				depth = 3f,
				runEffectInReverse = false
			};
			TransitionKit.instance.transitionWithDelegate( doorway );
		}


		if( GUILayout.Button( "Doorway (reversed) to Scene" ) )
		{
			var doorway = new DoorwayTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				perspective = 1.1f,
				runEffectInReverse = true
			};
			TransitionKit.instance.transitionWithDelegate( doorway );
		}


		if( GUILayout.Button( "Wind to Scene" ) )
		{
			var wind = new WindTransition()
			{
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				size = 0.3f
			};
			TransitionKit.instance.transitionWithDelegate( wind );
		}


		if( GUILayout.Button( "Curved Wind to Scene" ) )
		{
			var wind = new WindTransition()
			{
				useCurvedWind = true,
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1,
				duration = 1.0f,
				size = 0.3f,
				windVerticalSegments = 300f
			};
			TransitionKit.instance.transitionWithDelegate( wind );
		}


		if( GUILayout.Button( "Mask to Scene" ) )
		{
			var mask = new ImageMaskTransition()
			{
				maskTexture = maskTexture,
				backgroundColor = Color.yellow,
				nextScene = SceneManager.GetActiveScene().buildIndex == 1 ? 2 : 1
			};
			TransitionKit.instance.transitionWithDelegate( mask );
		}
	}
Example #31
0
 private void mdMessageBox_Load(object sender, EventArgs e)
 {
     FadeTransition.ShowAsyc(this);
 }
Example #32
0
    void OnGUI()
    {
        // hide the UI during transitions
        if (!_isUiVisible)
        {
            return;
        }

        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
            // bigger buttons for higher res mobile devices
            if (Screen.width >= 1500 || Screen.height >= 1500)
            {
                GUI.skin.button.fixedHeight = 60;
            }
        }

        if (GUILayout.Button("Fade to Scene"))
        {
            var fader = new FadeTransition()
            {
                nextScene   = Application.loadedLevel == 1 ? 2 : 1,
                fadedDelay  = 0.2f,
                fadeToColor = Color.black
            };
            TransitionKit.instance.transitionWithDelegate(fader);
        }


        if (GUILayout.Button("Vertical Slices to Scene"))
        {
            var slices = new VerticalSlicesTransition()
            {
                nextScene = Application.loadedLevel == 1 ? 2 : 1,
                divisions = Random.Range(3, 20)
            };
            TransitionKit.instance.transitionWithDelegate(slices);
        }


        if (GUILayout.Button("Triangle Slices to Scene"))
        {
            var slices = new TriangleSlicesTransition()
            {
                nextScene = Application.loadedLevel == 1 ? 2 : 1,
                divisions = Random.Range(2, 10)
            };
            TransitionKit.instance.transitionWithDelegate(slices);
        }


        if (GUILayout.Button("Pixelate to Scene with Random Scale Effect"))
        {
            var enumValues        = System.Enum.GetValues(typeof(PixelateTransition.PixelateFinalScaleEffect));
            var randomScaleEffect = (PixelateTransition.PixelateFinalScaleEffect)enumValues.GetValue(Random.Range(0, enumValues.Length));

            var pixelater = new PixelateTransition()
            {
                nextScene        = Application.loadedLevel == 1 ? 2 : 1,
                finalScaleEffect = randomScaleEffect,
                duration         = 1.0f
            };
            TransitionKit.instance.transitionWithDelegate(pixelater);
        }


        if (GUILayout.Button("Twirl via Component with No Scene Change"))
        {
            TransitionKit.instance.transitionWithDelegate(GetComponent <TwirlTransition>());
        }


        if (GUILayout.Button("Blur to Scene"))
        {
            var blur = new BlurTransition()
            {
                nextScene = Application.loadedLevel == 1 ? 2 : 1,
                duration  = 2.0f,
                blurMax   = 0.01f
            };
            TransitionKit.instance.transitionWithDelegate(blur);
        }


        if (GUILayout.Button("Wacky Blur with No Scene Change"))
        {
            var blur = new BlurTransition()
            {
                duration = 1.0f,
                blurMax  = 1f
            };
            TransitionKit.instance.transitionWithDelegate(blur);
        }


        if (GUILayout.Button("Big Squares to Scene"))
        {
            var squares = new SquaresTransition()
            {
                nextScene  = Application.loadedLevel == 1 ? 2 : 1,
                duration   = 2.0f,
                squareSize = new Vector2(5f, 4f),
                smoothness = 0.0f
            };
            TransitionKit.instance.transitionWithDelegate(squares);
        }


        if (GUILayout.Button("Little Squares to Scene"))
        {
            var squares = new SquaresTransition()
            {
                nextScene   = Application.loadedLevel == 1 ? 2 : 1,
                duration    = 2.0f,
                squareSize  = new Vector2(64f, 45f),
                squareColor = Color.yellow,
                smoothness  = 0.1f
            };
            TransitionKit.instance.transitionWithDelegate(squares);
        }


        if (GUILayout.Button("Ripples to Scene"))
        {
            var ripple = new RippleTransition()
            {
                nextScene = Application.loadedLevel == 1 ? 2 : 1,
                duration  = 1.0f,
                amplitude = 1500f,
                speed     = 20f
            };
            TransitionKit.instance.transitionWithDelegate(ripple);
        }


        if (GUILayout.Button("Fish Eye to Scene"))
        {
            var fishEye = new FishEyeTransition()
            {
                nextScene       = Application.loadedLevel == 1 ? 2 : 1,
                duration        = 1.0f,
                size            = 0.08f,
                zoom            = 10.0f,
                colorSeparation = 3.0f
            };
            TransitionKit.instance.transitionWithDelegate(fishEye);
        }


        if (GUILayout.Button("Fish Eye (alternate params) to Scene"))
        {
            var fishEye = new FishEyeTransition()
            {
                nextScene       = Application.loadedLevel == 1 ? 2 : 1,
                duration        = 2.0f,
                size            = 0.2f,
                zoom            = 100.0f,
                colorSeparation = 0.1f
            };
            TransitionKit.instance.transitionWithDelegate(fishEye);
        }


        if (GUILayout.Button("Doorway to Scene"))
        {
            var doorway = new DoorwayTransition()
            {
                nextScene          = Application.loadedLevel == 1 ? 2 : 1,
                duration           = 1.0f,
                perspective        = 1.5f,
                depth              = 3f,
                runEffectInReverse = false
            };
            TransitionKit.instance.transitionWithDelegate(doorway);
        }


        if (GUILayout.Button("Doorway (reversed) to Scene"))
        {
            var doorway = new DoorwayTransition()
            {
                nextScene          = Application.loadedLevel == 1 ? 2 : 1,
                duration           = 1.0f,
                perspective        = 1.1f,
                runEffectInReverse = true
            };
            TransitionKit.instance.transitionWithDelegate(doorway);
        }


        if (GUILayout.Button("Wind to Scene"))
        {
            var wind = new WindTransition()
            {
                nextScene = Application.loadedLevel == 1 ? 2 : 1,
                duration  = 1.0f,
                size      = 0.3f
            };
            TransitionKit.instance.transitionWithDelegate(wind);
        }


        if (GUILayout.Button("Curved Wind to Scene"))
        {
            var wind = new WindTransition()
            {
                useCurvedWind        = true,
                nextScene            = Application.loadedLevel == 1 ? 2 : 1,
                duration             = 1.0f,
                size                 = 0.3f,
                windVerticalSegments = 300f
            };
            TransitionKit.instance.transitionWithDelegate(wind);
        }


        if (GUILayout.Button("Mask to Scene"))
        {
            var mask = new ImageMaskTransition()
            {
                maskTexture     = maskTexture,
                backgroundColor = Color.yellow,
                nextScene       = Application.loadedLevel == 1 ? 2 : 1
            };
            TransitionKit.instance.transitionWithDelegate(mask);
        }
    }
Example #33
0
 private void FadeIn()
 {
     transitionScript = GetComponent <FadeTransition>();
     StartCoroutine(transitionScript.Fade(FadeTransition.FadeDirection.Out));
 }