Ejemplo n.º 1
0
        public static bool IsRegionRestricted(GameplaySettings settings, Item item)
        {
            if (settings.SmallKeyMode.HasFlag(SmallKeyMode.KeepWithinDungeon) && SmallKeys().Contains(item))
            {
                return(true);
            }

            if (settings.BossKeyMode.HasFlag(BossKeyMode.KeepWithinDungeon) && BossKeys().Contains(item))
            {
                return(true);
            }

            if (settings.StrayFairyMode.HasFlag(StrayFairyMode.KeepWithinDungeon) && DungeonStrayFairies().Contains(item))
            {
                return(true);
            }

            if (settings.BossRemainsMode.HasFlag(BossRemainsMode.KeepWithinDungeon) && BossRemains().Contains(item))
            {
                return(true);
            }

            if (settings.BossRemainsMode.HasFlag(BossRemainsMode.GreatFairyRewards) && BossRemains().Contains(item))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
    private PlayerStates UpdateFletchingState()
    {
        ControlSettingsInstance input            = GameManager.Instance.Controls.Input;
        ControlSettingsInstance alternativeInput = GameManager.Instance.Controls.AlternativeInput;

        if (Input.GetKeyUp(input.Interact) || Input.GetKeyUp(alternativeInput.Interact))
        {
            return(PlayerStates.Default);
        }

        GameplaySettings settings = GameManager.Instance.Settings;

        if (settings.TimeToGrindWeapon > 0)
        {
            if (inventory is Sword)
            {
                currentStation.SetProgressbarValue((inventory as Sword).SharpenSword(Time.deltaTime / settings.TimeToGrindWeapon));
            }
            else if (inventory is Wood)
            {
                currentStation.SetProgressbarValue((inventory as Wood).WorkOnWood(Time.deltaTime / settings.TimeToGrindWeapon));
            }
        }
        return(PlayerStates.Fletching);
    }
Ejemplo n.º 3
0
    private void Setup()
    {
        // Debug.Log("Set up");

        Settings = Resources.Load <GameplaySettings>("GameplaySettings");
//        Debug.Log($"Settings{Settings}");
        PlayerScore = new Dictionary <PlayerIndex, int>();

        for (int i = 0; i < (int)PlayerIndex.Two; i++)
        {
            PlayerScore.Add((PlayerIndex)i, 0);
        }

        if (BlockList == null)
        {
            BlockList = FindObjectOfType <BlockLists>();
        }

        if (BlockList == null)
        {
            BlockList = new GameObject("BlockList").AddComponent <BlockLists>();
        }

        _floorTag = GameObject.FindWithTag("Floor");
        if (_floorTag == null)
        {
            _floorTag     = new GameObject();
            _floorTag.tag = "Floor";
        }

        CurrentTime   = 0;
        _preGameTimer = Settings.PreRoundTime;
        IsPaused      = false;
        IsRoundOver   = false;
    }
Ejemplo n.º 4
0
        private void Start()
        {
            _player   = GameSettings.Instance.PlayerSettings;
            _gameplay = GameSettings.Instance.GameplaySettings;

            // without the PlayerActor scriptableobject there
            // is no defined parameters for the player movement
            if (!_player)
            {
                Debug.LogError("No " + typeof(PlayerActor) + " found. " +
                               "Disabling script...");
                enabled = false;
            }

            // neccesary components for the script to work
            this.GetNeededComponent(ref _rigidbody);
            this.GetNeededComponent(ref _state);
            this.GetNeededComponent(ref _animator);
            this.GetNeededComponent(ref _modelCollider);
            // prefetch animator parameters ids
            _animInflate = Animator.StringToHash("Inflate");
            _animFlatten = Animator.StringToHash("Flatten");
            // subscribe to player death event to stop movement
            EventManager.StartListening("PlayerDied", () => { enabled = false; });
            // subscribe to level reset to start movement again
            EventManager.StartListening("LevelReset", () => { enabled = true; });
            // subscribe to game pause events
            EventManager.StartListening("GamePaused", OnGamePaused);
            EventManager.StartListening("GameResumed", OnGameResumed);
        }
Ejemplo n.º 5
0
        public Hexagon GenerateHexagonAt(HexagonPosition hexagonPosition)
        {
            var     alreadyRevealed = HexagonManager.Count();
            Hexagon hexagon         = null;

            if (hexagonPosition == HexagonPosition.Zero)
            {
                hexagon = new Hexagon(ResourceType.DiamondOre, GetPayoutIntervalFor(ResourceType.DiamondOre), hexagonPosition);
            }
            else if (alreadyRevealed == 1)
            {
                hexagon = new Hexagon(ResourceType.PureWater, GetPayoutIntervalFor(ResourceType.PureWater), hexagonPosition);
            }
            else if (alreadyRevealed == 2)
            {
                hexagon = new Hexagon(ResourceType.CoalOre, GetPayoutIntervalFor(ResourceType.CoalOre), hexagonPosition);
            }
            else
            {
                var waterProbability = GameplaySettings.WaterSigmoid(hexagonPosition.DistanceToOrigin);
                if (HexMexRandom.NextDouble() < waterProbability)
                {
                    hexagon = new Hexagon(ResourceType.PureWater, 0, hexagonPosition);
                }
                else
                {
                    var resourceType = GetNextResourceType();
                    var dieSum       = GetPayoutIntervalFor(resourceType);
                    hexagon = new Hexagon(resourceType, dieSum, hexagonPosition);
                }
            }
            return(hexagon);
        }
Ejemplo n.º 6
0
        public static void CreateSpoilerLog(RandomizedResult randomized, GameplaySettings settings, OutputSettings outputSettings)
        {
            var itemList = randomized.ItemList
                           .Where(io => !io.Item.IsFake())
                           .Select(u => new SpoilerItem(u, ItemUtils.IsRequired(u.Item, randomized), ItemUtils.IsImportant(u.Item, randomized)));
            var settingsString = settings.ToString();

            var directory = Path.GetDirectoryName(outputSettings.OutputROMFilename);
            var filename  = $"{Path.GetFileNameWithoutExtension(outputSettings.OutputROMFilename)}";

            var     plainTextRegex = new Regex("[^a-zA-Z0-9' .\\-]+");
            Spoiler spoiler        = new Spoiler()
            {
                Version                      = Randomizer.AssemblyVersion,
                SettingsString               = settingsString,
                Seed                         = randomized.Seed,
                RandomizeDungeonEntrances    = settings.RandomizeDungeonEntrances,
                ItemList                     = itemList.Where(u => !u.Item.IsFake()).ToList(),
                NewDestinationIndices        = randomized.NewDestinationIndices,
                Logic                        = randomized.Logic,
                CustomItemListString         = settings.UseCustomItemList ? settings.CustomItemListString : null,
                CustomStartingItemListString = settings.CustomStartingItemList.Any() ? settings.CustomStartingItemListString : null,
                CustomJunkLocationsString    = settings.CustomJunkLocationsString,
                GossipHints                  = randomized.GossipQuotes?.ToDictionary(me => (GossipQuote)me.Id, (me) =>
                {
                    var message     = me.Message.Substring(1);
                    var soundEffect = message.Substring(0, 2);
                    message         = message.Substring(2);
                    if (soundEffect == "\x69\x0C")
                    {
                        // real
                    }
                    else if (soundEffect == "\x69\x0A")
                    {
                        // fake
                        message = "FAKE - " + message;
                    }
                    else
                    {
                        // junk
                        message = "JUNK - " + message;
                    }
                    return(plainTextRegex.Replace(message.Replace("\x11", " "), ""));
                }),
            };

            if (outputSettings.GenerateHTMLLog)
            {
                using (StreamWriter newlog = new StreamWriter(Path.Combine(directory, filename + "_Tracker.html")))
                {
                    Templates.HtmlSpoiler htmlspoiler = new Templates.HtmlSpoiler(spoiler);
                    newlog.Write(htmlspoiler.TransformText());
                }
            }

            if (outputSettings.GenerateSpoilerLog)
            {
                CreateTextSpoilerLog(spoiler, Path.Combine(directory, filename + "_SpoilerLog.txt"));
            }
        }
Ejemplo n.º 7
0
 private void Construct(SignalBus signalBus, EnemySpawner enemySpawner, FogManager fogManager, PowerupFactory powerupFactory, GameplaySettings gameplaySettings)
 {
     SignalBus         = signalBus;
     _enemySpawner     = enemySpawner;
     _fogManager       = fogManager;
     _powerupFactory   = powerupFactory;
     _gameplaySettings = gameplaySettings;
 }
Ejemplo n.º 8
0
 public GameSceneLoaded(GameplaySettings gameplaySettings)
 {
     Debug.Log("Event :: Core :: GameSceneLoaded");
     mazeType   = gameplaySettings.mazeType;
     mazeLength = gameplaySettings.mazeLength;
     mazeWidth  = gameplaySettings.mazeWidth;
     cellSize   = gameplaySettings.cellSize;
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     Gameplay = new GameplaySettings()
                .SetDashCooldown(dashCooldown)
                .SetDashForce(dashForce)
                .SetHookCooldown(hookCooldown)
                .SetStunDuration(stunDuration);
 }
Ejemplo n.º 10
0
 public GameSettings(LayoutSettings layoutSettings, VisualSettings visualSettings, GameplaySettings gameplaySettings, BuildingDescriptionDatabase buildingDescriptionDatabase, LanguageSettings languageSettings)
 {
     LayoutSettings              = layoutSettings;
     VisualSettings              = visualSettings;
     GameplaySettings            = gameplaySettings;
     BuildingDescriptionDatabase = buildingDescriptionDatabase;
     LanguageSettings            = languageSettings;
 }
Ejemplo n.º 11
0
 public CachedPathFinder(HexagonManager hexagonManager, StructureManager structureManager, GameplaySettings gameplaySettings)
 {
     PathFinding      = new PathFinding <HexagonNode, float>((i, j) => i + j, h => h.GetAccessibleAdjacentHexagonNodes(HexagonManager).Where(a => StructureManager[a] != null), CalculateHeuristik, (c, n) => gameplaySettings.DefaultResourceTimeBetweenNodes);
     HexagonManager   = hexagonManager;
     StructureManager = structureManager;
     GameplaySettings = gameplaySettings;
     StructureManager.StructureAdded   += StructureAdded;
     StructureManager.StructureRemoved += StructureRemoved;
 }
Ejemplo n.º 12
0
    public Agent(Ship ship)
    {
        Ship        = ship;
        ItemManager = Ship.ItemManager;
        Settings    = Ship.ItemManager.GameplaySettings;

        _rootState     = _currentState = new BaseState(this);
        _velocityLimit = Ship.GetBehavior <VelocityLimit>();
    }
Ejemplo n.º 13
0
 private void Construct(SignalBus signalBus, Player player, FogManager fogManager, MonoBehaviourUtil monoBehaviourUtil, GameplaySettings gameplaySettings, EnemySpawner enemySpawner)
 {
     _signalBus         = signalBus;
     _player            = player;
     _fogManager        = fogManager;
     _monoBehaviourUtil = monoBehaviourUtil;
     _gameplaySettings  = gameplaySettings;
     _enemySpawner      = enemySpawner;
 }
Ejemplo n.º 14
0
 private void Awake()
 {
     _gameplay = GameSettings.Instance.GameplaySettings;
     // get neccesary components for this script to work
     this.GetNeededComponent(ref _rigidbody);
     this.GetNeededComponent(ref _collider);
     this.GetNeededComponent(ref _trailRenderer);
     // subscribe to game pause events
     EventManager.StartListening("GamePaused", OnGamePaused);
     EventManager.StartListening("GameResumed", OnGameResumed);
 }
Ejemplo n.º 15
0
 private void Construct(InputManager inputManager, PlayerMovement movement, ControllerSettings controllerSettings,
                        GameplaySettings gameplaySettings, BulletManager bulletManager)
 {
     _inputManager       = inputManager;
     _movement           = movement;
     _controllerSettings = controllerSettings;
     _settings           = gameplaySettings.PlayerSettings;
     _gameplaySettings   = gameplaySettings;
     _bulletManager      = bulletManager;
     //_fogManager = fogManager;
 }
Ejemplo n.º 16
0
        private void Start()
        {
            _gameplay = GameSettings.Instance.GameplaySettings;

            if (null != _playButton)
            {
                _playButton.onClick.AddListener(() =>
                {
                    LoadScene(_nextScene);
                });
            }

            if (null != _quitButton)
            {
                _quitButton.onClick.AddListener(Application.Quit);
            }

            SetOption(_playerHealthField, _gameplay.HealthPoints, str =>
            {
                int value;

                if (int.TryParse(str, out value))
                {
                    _gameplay.HealthPoints = value;
                }
            });
            SetOption(_playerSpeedField, _gameplay.PlayerSpeedMultiplier, str =>
            {
                float value;

                if (float.TryParse(str, out value))
                {
                    _gameplay.PlayerSpeedMultiplier = value;
                }
            });
            SetOption(_enemySpeedField, _gameplay.EnemySpeedMultiplier, str =>
            {
                float value;

                if (float.TryParse(str, out value))
                {
                    _gameplay.EnemySpeedMultiplier = value;
                }
            });
            SetOption(_projectileDamageField, _gameplay.ProjectileDamage, str =>
            {
                int value;

                if (int.TryParse(str, out value))
                {
                    _gameplay.ProjectileDamage = value;
                }
            });
        }
Ejemplo n.º 17
0
        // Returns the default settings instance and creates it if it doesn't exist yet
        private GameSettings GetDefaultSettings()
        {
            if (_defaultSettings == null)
            {
                AudioSettings audioSettings = new AudioSettings
                {
                    Enabled = true,
                    Volume  = 100,
                    SfxSet  = 1
                };

                VideoSettings videoSettings = new VideoSettings
                {
                    Resolution = SettingsConstants.DefaultResolution,
                    VSync      = true
                };

                Type paddleType = typeof(PlayerPaddle);

                GameplaySettings gameplaySettings = new GameplaySettings
                {
                    BallCount       = 1,
                    GameSpeed       = 1F,
                    LeftPaddleType  = paddleType,
                    RightPaddleType = paddleType,
                    ScoreLimit      = 5
                };

                ControlSettings controls = new ControlSettings
                {
                    LeftPaddle = new ControlScheme
                    {
                        MoveUp   = Keys.W,
                        MoveDown = Keys.S
                    },
                    RightPaddle = new ControlScheme
                    {
                        MoveUp   = Keys.Up,
                        MoveDown = Keys.Down
                    }
                };

                _defaultSettings = new GameSettings
                {
                    Audio    = audioSettings,
                    Video    = videoSettings,
                    Gameplay = gameplaySettings,
                    Controls = controls
                };
            }

            return(_defaultSettings);
        }
Ejemplo n.º 18
0
        private void Start()
        {
            _gameplay = GameSettings.Instance.GameplaySettings;

            if (!_enemy)
            {
                Debug.LogError("No " + typeof(DynamicActor) + " found. " +
                               "Disabling script...");
                enabled = false;
            }

            // pretch player
            GameObject player = GameObject.FindGameObjectWithTag("Player");

            if (null == player)
            {
                Debug.LogError("No player transform found, use the Player tag");
                enabled = false;
            }
            else
            {
                _player = player.transform;
            }

            // get needed components
            this.GetNeededComponent(ref _animator);
            _audio = GetComponent <AudioSource>();

            if (null != _animator)
            {
                _dissapearAnimation = Animator.StringToHash("Dissapear");
            }

            // create bullet pool
            _bulletPool = ObjectPool.Instance(_bulletObject, 20);
            _bulletPool.Preload();

            // fire rate
            if (_enemy.Speed > 0.0)
            {
                InvokeRepeating("FireBullet", 0.0f,
                                1.0f / (_enemy.Speed * _gameplay.EnemySpeedMultiplier));
            }
            else
            {
                Debug.LogError("Enemy speed controls the firing rate, use a value" +
                               "greater than zero.");
            }

            // pause events
            EventManager.StartListening("GamePaused", () => { enabled = false; });
            EventManager.StartListening("GameResumed", () => { enabled = true; });
        }
Ejemplo n.º 19
0
    public ControlSystem(GameplaySettings gameplaySettings)
    {
        settings        = gameplaySettings;
        Physics.gravity = new Vector3(0, -settings.Gravity, 0);

        touchControl                   = Object.FindObjectOfType <TouchControl>();
        touchControl.onBeginPull      += HandleBeginPull;
        touchControl.onPullHorizontal += HandlePullHorizontal;
        touchControl.onPullVertical   += HandlePullVertical;

        cameraRig = Object.FindObjectOfType <CameraRig>();
        LocalWindZone.getWindForce += () => clampedWindForce;
    }
Ejemplo n.º 20
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
            return;
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 21
0
        /// <summary>
        /// Finalize configuration using <see cref="GameplaySettings"/>.
        /// </summary>
        /// <param name="settings">Settings</param>
        public void FinalizeSettings(GameplaySettings settings)
        {
            // Update speedup flags which correspond with ShortenCutscenes.
            this.Speedups.BlastMaskThief = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.BlastMaskThief);
            this.Speedups.BoatArchery    = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.BoatArchery);
            this.Speedups.FishermanGame  = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.FishermanGame);
            this.Speedups.SoundCheck     = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.MilkBarPerformance);
            this.Speedups.DonGero        = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.HungryGoron);

            // If using Adult Link model, allow Mikau cutscene to activate early.
            this.Flags.EarlyMikau = settings.Character == Character.AdultLink;

            // Update internal flags.
            this.InternalFlags.VanillaLayout = settings.LogicMode == LogicMode.Vanilla;
        }
    private void OnNextButtonPressed()
    {
        Ramses.Confactory.ConfactoryFinder.Instance.Give <ConSelectedLanguages>().SetLanguages(
            selectedLanguageList, selectedLanguageToTranslate, selectedTranslationLanguage);

        GameplaySettings settings = new GameplaySettings();

        settings.GameDifficulty          = ((GameDifficulties)difficultyDropdown.value);
        settings.ShowWordToTranslateOnly = showWordToTranslateOnlyToggle.isOn;

        Debug.Log(settings.ShowWordToTranslateOnly);

        Ramses.Confactory.ConfactoryFinder.Instance.Give <ConCurrentGameplaySettings>().SetCurrentGameplaySettings(settings);
        menuContextHolder.SwitchSceneContext(MenuContextHolder.ContextScreens.PlayLevelSelectContext);
        Debug.Log("Next!");
    }
Ejemplo n.º 23
0
 private void Start()
 {
     _gameplay = GameSettings.Instance.GameplaySettings;
     // prefetch animation parameter identifiers
     _dissapearAnimation = Animator.StringToHash("Dissapear");
     _appearAnimation    = Animator.StringToHash("Appear");
     // add heart assets to build interface
     BuildHeartsInterface();
     // subscribe to health reduction event
     EventManager.StartListening("HealthReduced", () =>
     {
         _availableHearts--;
         AnimateHeart(_dissapearAnimation);
     });
     // subscribe to level restart event
     EventManager.StartListening("LevelReset", Restart);
 }
Ejemplo n.º 24
0
    private PlayerStates UpdateSmithingState()
    {
        ControlSettingsInstance input            = GameManager.Instance.Controls.Input;
        ControlSettingsInstance alternativeInput = GameManager.Instance.Controls.AlternativeInput;

        if (Input.GetKeyUp(input.Interact) || Input.GetKeyUp(alternativeInput.Interact))
        {
            return(PlayerStates.Default);
        }

        GameplaySettings settings = GameManager.Instance.Settings;

        if (settings.TimeForSmithing > 0)
        {
            (inventory as Sword).HammerSword(Time.deltaTime / settings.TimeForSmithing);
        }
        currentStation.SetProgressbarValue((inventory as Sword).Quality);
        return(PlayerStates.Smithing);
    }
Ejemplo n.º 25
0
        private void Start()
        {
            _gameplay = GameSettings.Instance.GameplaySettings;
            _model    = GetComponentInChildren <MeshRenderer>();
            // neccesary components for the script to work
            this.GetNeededComponent(ref _rigidbody);
            this.GetNeededComponent(ref _agent);
            this.GetNeededComponent(ref _modelCollider);
            this.GetNeededComponent(ref _animator);

            if (null != _animator)
            {
                _dissapearAnimation = Animator.StringToHash("Dissapear");
            }

            // neccesary for enemy parameters
            if (!_enemy)
            {
                Debug.LogError("No " + typeof(DynamicActor) + " found. " +
                               "Disabling script...");
                enabled = false;
            }
            else
            {
                if (_agent)
                {
                    _agent.speed        = _enemy.Speed * _gameplay.EnemySpeedMultiplier;
                    _agent.angularSpeed = _enemy.AngularSpeed * _gameplay.EnemySpeedMultiplier;
                }
            }

            if (null == _points || _points.Length <= 1)
            {
                // first point is itself
                _points = new[] { transform };
            }

            // set to initial state
            Restart();
            // pause events
            EventManager.StartListening("GamePaused", OnGamePaused);
            EventManager.StartListening("GameResumed", OnGameResumed);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Finalize configuration using <see cref="GameplaySettings"/>.
        /// </summary>
        /// <param name="settings">Settings</param>
        public void FinalizeSettings(GameplaySettings settings)
        {
            // Update speedup flags which correspond with ShortenCutscenes.
            this.Speedups.BlastMaskThief = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.BlastMaskThief);
            this.Speedups.BoatArchery    = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.BoatArchery);
            this.Speedups.FishermanGame  = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.FishermanGame);
            this.Speedups.SoundCheck     = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.MilkBarPerformance);
            this.Speedups.DonGero        = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.HungryGoron);
            this.Speedups.FastBankRupees = settings.ShortenCutsceneSettings.General.HasFlag(ShortenCutsceneGeneral.FasterBankText);

            // If using Adult Link model, allow Mikau cutscene to activate early.
            this.Flags.EarlyMikau = settings.Character == Character.AdultLink;

            this.Flags.FairyChests = settings.StrayFairyMode.HasFlag(StrayFairyMode.ChestsOnly);

            // Update internal flags.
            this.InternalFlags.VanillaLayout      = settings.LogicMode == LogicMode.Vanilla;
            this.Shorts.CollectableTableFileIndex = ItemSwapUtils.COLLECTABLE_TABLE_FILE_INDEX;
        }
Ejemplo n.º 27
0
    private void Start()
    {
        sfx = GetComponent <AudioSource>();

        GameObject hookPrefab = prefabs.transform.Find("Hook")?.gameObject;

        Assert.IsNotNull(hookPrefab, "No Hook prefab exists!");

        gameplaySettings = settings.GetComponent <Settings>()?.Gameplay ?? new GameplaySettings();
        Player.Initialize(gameObject, hookPrefab, bindings, movementSettings, gameplaySettings);
        ImpactParticle.GetComponent <Renderer>().enabled = false;

        Material respawnMaterial = new Material(dissolveMaterial);

        respawnMaterial.SetColor("_emission_color", Player.IsBlue() ? Colors.BLUE_COLOR : Colors.RED_COLOR);
        for (int i = 0; i < respawnMaterials.Length; i++)
        {
            respawnMaterials[i] = respawnMaterial;
        }
    }
Ejemplo n.º 28
0
    private PlayerStates UpdateDefaultState()
    {
        GameplaySettings        settings         = GameManager.Instance.Settings;
        ControlSettingsInstance input            = GameManager.Instance.Controls.Input;
        ControlSettingsInstance alternativeInput = GameManager.Instance.Controls.AlternativeInput;

        bool isWalking = false;

        if (Input.GetKeyDown(input.Interact) || Input.GetKeyDown(alternativeInput.Interact))
        {
            return(HandleInteractions());
        }
        if (Input.GetKey(input.Up) || Input.GetKey(alternativeInput.Up))
        {
            Move(Vector2.up * settings.PlayerSpeeds.y);
            characterSpriteManager.SetState(CharacterSpriteManager.CharacterState.Backward);
            isWalking = true;
        }
        if (Input.GetKey(input.Right) || Input.GetKey(alternativeInput.Right))
        {
            Move(Vector2.right * settings.PlayerSpeeds.x);
            characterSpriteManager.SetState(CharacterSpriteManager.CharacterState.Right);
            isWalking = true;
        }
        if (Input.GetKey(input.Left) || Input.GetKey(alternativeInput.Left))
        {
            Move(Vector2.left * settings.PlayerSpeeds.x);
            characterSpriteManager.SetState(CharacterSpriteManager.CharacterState.Left);
            isWalking = true;
        }
        if (Input.GetKey(input.Down) || Input.GetKey(alternativeInput.Down))
        {
            Move(Vector2.down * settings.PlayerSpeeds.y);
            characterSpriteManager.SetState(CharacterSpriteManager.CharacterState.Forward);
            isWalking = true;
        }
        anim.SetBool("isWalking", isWalking);

        return(PlayerStates.Default);
    }
Ejemplo n.º 29
0
        private void Start()
        {
            _player = GameSettings.Instance.PlayerSettings;
            _gameplay = GameSettings.Instance.GameplaySettings;

            // without the GameplaySettings scriptableobject there
            // are no defined parameters for the player health
            if (!_gameplay)
            {
                Debug.LogError("No " + typeof(GameplaySettings) + " found. " +
                               "Disabling script...");
                enabled = false;
            }
            else
            {
                Health = _gameplay.HealthPoints;
            }

            // event to receive hits from other objects
            EventManager.StartListening("HitPlayer", Hit);
            // restore health on level reset
            EventManager.StartListening("LevelReset", Restart);
        }
Ejemplo n.º 30
0
 public RandomizedResult(GameplaySettings settings, int seed)
 {
     Settings = settings;
     Seed     = seed;
 }
Ejemplo n.º 31
0
        public static LogicPaths GetImportantItems(ItemList itemList, GameplaySettings settings, Item item, List <ItemLogic> itemLogic, List <Item> logicPath = null, Dictionary <Item, LogicPaths> checkedItems = null, params Item[] exclude)
        {
            if (settings.CustomStartingItemList.Contains(item))
            {
                return(new LogicPaths());
            }
            if (logicPath == null)
            {
                logicPath = new List <Item>();
            }
            if (logicPath.Contains(item))
            {
                return(null);
            }
            if (exclude.Contains(item))
            {
                if (settings.AddSongs || !ItemUtils.IsSong(item) || logicPath.Any(i => !i.IsFake() && itemList[i].IsRandomized && !ItemUtils.IsSong(i)))
                {
                    return(null);
                }
            }
            logicPath.Add(item);
            if (checkedItems == null)
            {
                checkedItems = new Dictionary <Item, LogicPaths>();
            }
            if (checkedItems.ContainsKey(item))
            {
                if (logicPath.Intersect(checkedItems[item].Required).Any())
                {
                    return(null);
                }
                return(checkedItems[item]);
            }
            var itemObject    = itemList[item];
            var locationId    = itemObject.NewLocation.HasValue ? itemObject.NewLocation : item;
            var locationLogic = itemLogic[(int)locationId];
            var required      = new List <Item>();
            var important     = new List <Item>();

            if (locationLogic.RequiredItemIds != null && locationLogic.RequiredItemIds.Any())
            {
                foreach (var requiredItemId in locationLogic.RequiredItemIds)
                {
                    var childPaths = GetImportantItems(itemList, settings, (Item)requiredItemId, itemLogic, logicPath.ToList(), checkedItems, exclude);
                    if (childPaths == null)
                    {
                        return(null);
                    }
                    required.Add((Item)requiredItemId);
                    if (childPaths.Required != null)
                    {
                        required.AddRange(childPaths.Required);
                    }
                    if (childPaths.Important != null)
                    {
                        important.AddRange(childPaths.Important);
                    }
                }
            }
            if (locationLogic.ConditionalItemIds != null && locationLogic.ConditionalItemIds.Any())
            {
                var logicPaths = new List <LogicPaths>();
                foreach (var conditions in locationLogic.ConditionalItemIds)
                {
                    var conditionalRequired  = new List <Item>();
                    var conditionalImportant = new List <Item>();
                    foreach (var conditionalItemId in conditions)
                    {
                        var childPaths = GetImportantItems(itemList, settings, (Item)conditionalItemId, itemLogic, logicPath.ToList(), checkedItems, exclude);
                        if (childPaths == null)
                        {
                            conditionalRequired  = null;
                            conditionalImportant = null;
                            break;
                        }

                        conditionalRequired.Add((Item)conditionalItemId);
                        if (childPaths.Required != null)
                        {
                            conditionalRequired.AddRange(childPaths.Required);
                        }
                        if (childPaths.Important != null)
                        {
                            conditionalImportant.AddRange(childPaths.Important);
                        }
                    }

                    if (conditionalRequired != null && conditionalImportant != null)
                    {
                        logicPaths.Add(new LogicPaths
                        {
                            Required  = conditionalRequired.AsReadOnly(),
                            Important = conditionalImportant.AsReadOnly()
                        });
                    }
                }
                if (!logicPaths.Any())
                {
                    return(null);
                }
                required.AddRange(logicPaths.Select(lp => lp.Required.AsEnumerable()).Aggregate((a, b) => a.Intersect(b)));
                important.AddRange(logicPaths.SelectMany(lp => lp.Required.Union(lp.Important)).Distinct());
            }
            var result = new LogicPaths
            {
                Required  = required.Distinct().ToList().AsReadOnly(),
                Important = important.Union(required).Distinct().ToList().AsReadOnly()
            };

            if (!item.IsFake())
            {
                checkedItems[item] = result;
            }
            return(result);
        }