Esempio n. 1
0
        public int Next(RangeInt range)
        {
            if (range.Length == 0)
            {
                return range.Min;
            }

            return range.Min + this.Next(range.Length + 1);
        }
Esempio n. 2
0
        public override bool TryParse(string path, ref RangeInt cursor, out IWatchContext ctx)
        {
            var c = cursor;

            ParserUtils.TryParseAt(path, ref c, ".");
            foreach (var v in Variables)
            {
                if (ParserUtils.TryParseToken(path, ref c, v.Key))
                {
                    cursor = c;
                    ctx    = v.Value;
                    return(true);
                }
            }
            ctx = null;
            return(false);
        }
Esempio n. 3
0
 public override bool TryParseIndex(string path, RangeInt cursor, out IWatchContext ctx)
 {
     if (ParserUtils.TryParseScopeSequenceRange(path, ref cursor, ParserUtils.DelemiterQuote, out var worldNameRangeIn, out var worldNameRangeOut))
     {
         string worldName = path.Substring(worldNameRangeIn);
         foreach (var w in Entities.World.All)
         {
             if (w.Name == worldName)
             {
                 ctx = new WorldContext(this, $"[\"{worldName}\"]", w, ContextFieldInfo.MakeOperator($"[\"{worldName}\"]"));
                 return(true);
             }
         }
     }
     ctx = default;
     return(false);
 }
Esempio n. 4
0
 public override bool TryParseIndex(string path, RangeInt cursor, out IWatchContext ctx)
 {
     if (ParserUtils.TryParseScopeSequenceRange(path, ref cursor, ParserUtils.DelemiterQuote, out var nameRangeIn, out var nameRangeOut))
     {
         string name = path.Substring(nameRangeIn);
         for (int i = 0; i != UnityEngine.SceneManagement.SceneManager.sceneCount; ++i)
         {
             var s = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
             if (s.name == name)
             {
                 ctx = new SceneContext(this, $"[\"{name}\"]", s, ContextFieldInfo.MakeOperator($"[\"{name}\"]"));
                 return(true);
             }
         }
     }
     ctx = default;
     return(false);
 }
    private void PlaceBottomTile(int row, int col)
    {
        Tile     tile       = terrainController.bottomTile;
        int      lavaChance = Random.Range(0, 1000);
        RangeInt lavaRange  = new RangeInt(0, 1);

        if (lavaChance >= lavaRange.start && lavaChance <= lavaRange.end)
        {
            InstantiateLavaSpawnPoint(new Vector3Int(-row + width / 2, -col + height / 2, 0));
        }
        else
        {
            terrainController.bottomMap.SetTile(
                new Vector3Int(
                    -row + width / 2,
                    -col + height / 2,
                    0), tile);
        }
    }
Esempio n. 6
0
        public void BeginPath()
        {
            requiresGeometryUpdate = true;

            if (buildingPath)
            {
                // delete old path if it hasn't ended
                pointList.size = currentPath.pointRange.start;
                holeList.size  = currentPath.holeRange.start;
            }

            currentShapeRange = new RangeInt(shapeList.size, 0);

            currentPath = new PathDef();
            currentPath.pointRange.start = pointList.size;
            currentPath.holeRange.start  = holeList.size;

            inHole = false; // just in case
        }
Esempio n. 7
0
    public void flipCards(RangeInt range, bool faceUp)
    {
        if (range.start > cardModels.Count || range.end > cardModels.Count)
        {
            return;
        }

        for (int i = range.start; i < range.end; i++)
        {
            if (CardFlipEvent != null)
            {
                CardFlipEvent(this, new CardEventArgs(cardModels[i]));
            }
            else
            {
                cardModels[i].isFaceUp = faceUp;
            }
        }
    }
Esempio n. 8
0
 public override bool TryParseIndex(string path, RangeInt cursor, out IWatchContext ctx)
 {
     if (ParserUtils.TryParseScopeSequenceRange(path, ref cursor, ParserUtils.DelemiterQuote, out var nameRangeIn, out var nameRangeOut))
     {
         string name = path.Substring(nameRangeIn);
         foreach (var go in Scene.GetRootGameObjects())
         {
             if (go.name == name)
             {
                 GameObject go2 = go;
                 ctx = new GameObjectContext(this, $"[\"{name}\"]", go, ContextFieldInfo.MakeOperator($"[\"{name}\"]"));
                 //ctx = new PropertyPathContext<GameObject, GameObject>(this, this, $"[\"{name}\"]", ref go2, null, ContextFieldInfo.MakeOperator($"[\"{name}\"]"));
                 //ctx = new PropertyBagContext<GameObject>(this, $"[\"{name}\"]", ref go2, ContextFieldInfo.MakeOperator($"[\"{name}\"]"));
                 return(true);
             }
         }
     }
     ctx = default;
     return(false);
 }
Esempio n. 9
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            int start;
            LuaObject.checkType(l, 2, out start);
            int length;
            LuaObject.checkType(l, 3, out length);
            RangeInt rangeInt = new RangeInt(start, length);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, rangeInt);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    private void PlaceTopTile(int row, int col)
    {
        Tile tile;
        int  goldChance    = Random.Range(0, 300);
        int  diamondChance = Random.Range(0, 1000);

        RangeInt goldRange    = new RangeInt(0, 1);
        RangeInt diamondRange = new RangeInt(2, 3);

        tile = terrainController.topTile;
        if (goldChance >= goldRange.start && goldChance <= goldRange.end)
        {
            tile = terrainController.goldTile;
        }
        if (diamondChance >= diamondRange.start && diamondChance <= diamondRange.end)
        {
            tile = terrainController.diamondTile;
        }

        terrainController.topMap.SetTile(new Vector3Int(-row + width / 2, -col + height / 2, 0), tile);
    }
Esempio n. 11
0
        public void BeginPath(float x, float y)
        {
            requiresGeometryUpdate = true;

            if (buildingPath)
            {
                // delete old path if it hasn't ended
                pointList.size = currentPath.pointRange.start;
                holeList.size  = currentPath.holeRange.start;
            }

            currentShapeRange = new RangeInt(shapeList.size, 0);

            currentPath = new PathDef();
            currentPath.pointRange.start = pointList.size;
            currentPath.holeRange.start  = holeList.size;
            currentPath.pointRange.length++;
            pointList.Add(new PathPoint(x, y, PointFlag.Corner));
            buildingPath = true;
            inHole       = false; // just in case
            lastPoint    = new Vector2(x, y);
        }
Esempio n. 12
0
    public void UpdateViewableCells(Vector2 pos)
    {
        RangeInt range = GetIndexRangeOfViwableCells();

        //deactivate hidden cells
        List <ViwedCellHelper> removeIndexes = new List <ViwedCellHelper>();

        foreach (var viwedCellHelper in usedCells)
        {
            if (viwedCellHelper.index < range.start || viwedCellHelper.index > range.end)
            {
                removeIndexes.Add(viwedCellHelper);
            }
        }

        foreach (var viwedCellHelper in removeIndexes)
        {
            usedCells.Remove(viwedCellHelper);
            viwedCellHelper.cell.SetActive(false);
            unusedCells.Enqueue(viwedCellHelper.cell);
            viwedCellHelper.cell = null;
        }

        //activate and populate new cells that appear
        for (int index = range.start; index <= range.end && index < ListLength; index++)
        {
            if (!IsCellInViewPort(index) && index >= 0)
            {
                var item = GetReusabelCell();
                usedCells.Add(new ViwedCellHelper(item.gameObject, index));
                item.name = CellPrefab.name;
                if (listViewDelegate != null)
                {
                    listViewDelegate.PopulateEachCell(item.gameObject, index);
                }
                SetListItemRectPosByIndex(item, index);
            }
        }
    }
Esempio n. 13
0
    private void Start()
    {
        spritesParent.GetComponent <SpriteRenderer>().sprite = GameParameters.BossSprite;
        System.Random rnd = new System.Random();
        float[]       attackspeeds = new float[] { GameParameters.playerAttackSpeedDefault, GameParameters.playerAttackSpeedUpgrade1, GameParameters.playerAttackSpeedUpgrade2 }.OrderBy(x => rnd.Next()).ToArray();
        float[]       damages = new float[] { GameParameters.playerDamageDefault, GameParameters.playerDamageUpgrade1, GameParameters.playerDamageUpgrade2 }.OrderBy(x => rnd.Next()).ToArray();
        float[]       moveSpeeds = new float[] { GameParameters.playerSpeedDefault, GameParameters.playerSpeedUpgrade1, GameParameters.playerSpeedUpgrade2 }.OrderBy(x => rnd.Next()).ToArray();
        float[]       maxHealths = new float[] { GameParameters.playerMaxHealthDefault, GameParameters.playerMaxHealthUpgrade1, GameParameters.playerMaxHealthUpgrade2 }.OrderBy(x => rnd.Next()).ToArray();
        bool[]        spells = new bool[] { false, true, true, true }.OrderBy(x => rnd.Next()).ToArray();
        bool[]        spellUpgrade = new bool[] { true, false, false, false }.OrderBy(x => rnd.Next()).ToArray();

        attackSpeed    = attackspeeds[0];
        damage         = damages[0];
        characterSpeed = moveSpeeds[0];

        hasFireball        = spells[2];
        hasIceball         = spells[3];
        hasFireballUpgrade = spellUpgrade[2];
        hasIceballUpgrade  = spellUpgrade[3];

        rockshield = new List <GameObject>();
        if (spells[0])
        {
            numberOfRockShield = spellUpgrade[0] ? GameParameters.numberOfRockShieldUpgrade : GameParameters.numberOfRockShieldDefault;
            GenerateRockShield();
            ActivateRockShield();
        }
        if (spells[1])
        {
            airshieldRange = spellUpgrade[1] ? GameParameters.airShieldActivationRangeUpgrade : GameParameters.airShieldActivationRangeDefault;
            CreateAirShield();
        }

        GetSpriteRenderer();

        target = GameObject.FindGameObjectWithTag("Player");

        StartCoroutine(Actions());
    }
Esempio n. 14
0
        public static bool TryParseDeepest(IWatchContext ctxFirst, string path, ref RangeInt cursor, out IWatchContext ctxResult)
        {
            var           c      = cursor;
            IWatchContext curCtx = ctxFirst;

            while (c.length > 0)
            {
                var nextCursor = c;
                if (ParserUtils.TryExtractPathPart(path, ref nextCursor, out var partRange))
                {
                    if (curCtx.TryParse(path, ref partRange, out var nextCtx))
                    {
                        c      = nextCursor;
                        curCtx = nextCtx;
                        continue;
                    }
                }
                break;
            }
            cursor    = c;
            ctxResult = curCtx;
            return(true);
        }
Esempio n. 15
0
        void UpdateAutoComplete()
        {
            AutoCompleteSuggestions.Clear();
            RangeInt cursor = addWatchText.Range();

            if (AutoCompleteGlobalContext.TryParseDeepest(addWatchText, ref cursor, out AutoCompleteDeepestContext))
            {
                if (AutoCompleteDeepestContext != AutoCompleteGlobalContext)
                {
                    AutoCompleteSuggestions.Add(new ContextMemberInfo(ContextFieldInfo.Make(".."), ContextTypeInfo.Make(AutoCompleteDeepestContext.GetType())));
                }
                AutoCompleteValidString = addWatchText.Substring(0, cursor.start);
                AutoCompleteDeepestContext.VisitAllMembers((ContextMemberInfo info) =>
                {
                    AutoCompleteSuggestions.Add(info);
                    return(true);
                });
                //ParserUtils.TryParseAt(addWatchText, ref cursor, ".");
                //if (ctx.TryCreateWatch(addWatchText, cursor, out var w))
                //{
                //    WatchRegistry.AddWatch(w);
                //}
            }
        }
Esempio n. 16
0
        public override bool TryParse(string path, ref RangeInt cursor, out IWatchContext ctx)
        {
            var c = cursor;

            if (ParserUtils.TryParseScopeSequenceRange(path, ref c, ParserUtils.DelemiterSquareBracket, out var seqIn, out var seqOut))
            {
                if (ParserUtils.TryParseIntAt(path, ref seqIn, out var index))
                {
                    var es = World.EntityManager.GetAllEntities();
                    for (int i = 0; i != es.Length; ++i)
                    {
                        if (es[i].Index == index)
                        {
                            cursor = c;
                            var ctnr = new EntityContainer(World.EntityManager, es[i]);
                            ctx = new PropertyPathContext <EntityContainer, EntityContainer>(this, this, $"[{es[i].Index}]", ctnr, null, ContextFieldInfo.MakeOperator($"[{es[i].Index}]"));
                            return(true);
                        }
                    }
                }
            }
            ctx = null;
            return(false);
        }
Esempio n. 17
0
        /// <summary>
        /// The Contains
        /// </summary>
        /// <param name="container">The container<see cref="RangeInt"/></param>
        /// <param name="range">The range<see cref="RangeInt"/></param>
        /// <returns>The <see cref="bool"/></returns>
        public static bool Contains(this RangeInt container, RangeInt range)
        {
            var contains = range.Start.IsInRange(container.Start, container.End) && range.End.IsInRange(container.Start, container.End);

            return(contains);
        }
Esempio n. 18
0
 /// <summary>
 /// The Length
 /// </summary>
 /// <param name="range">The range<see cref="RangeInt"/></param>
 /// <returns>The <see cref="int"/></returns>
 public static int Length(this RangeInt range)
 {
     return(range.End - range.Start);
 }
        public void CalcAABBRanges(float left, float bottom, float right, float top, float cellSize, out RangeInt cols, out RangeInt rows)
        {
            int xStart = Mathf.Clamp(Mathf.FloorToInt(left / cellSize) - AABBBoundary, 0, ColNum - 1);
            int xEnd   = Mathf.Clamp(Mathf.FloorToInt(right / cellSize) + AABBBoundary, 0, ColNum - 1);

            cols = new RangeInt(xStart, xEnd - xStart);

            int yStart = Mathf.Clamp(Mathf.FloorToInt(bottom / cellSize) - AABBBoundary, 0, RowNum - 1);
            int yEnd   = Mathf.Clamp(Mathf.FloorToInt(top / cellSize) + AABBBoundary, 0, RowNum - 1);

            rows = new RangeInt(yStart, yEnd - yStart);
        }
        protected IRequestToken LoadScores(RangeInt scoreRange, ScoreloopCallback<LeaderboardScoresResponse> callback)
        {
            ScoreloopCallback<LeaderboardScoresResponse> innerCallback = response =>
            {
                if (_latestScoreRequestToken != null && response.RequestSource == _latestScoreRequestToken.RequestSource)
                {
                    _latestScoreRequestToken = null;
                }

                // if less scores than the requested amount was loaded, that *should* mean that there are no more scores to load
                if (response.Success && response.Data.Scores.Count != scoreRange.Length)
                {
                    _canLoadMoreScores = false;
                }

                this.OnScoresLoaded(response);
                if (callback != null)
                {
                    callback(response);
                }
            };

            this.CancelLatestScoreRequest();
            _latestScoreRequestToken = _scoreloopManager.LoadScores(_leaderboardScope, scoreRange, _mode, innerCallback);
            return _latestScoreRequestToken;
        }
Esempio n. 21
0
 private record Policy(RangeInt Range, char Character);
Esempio n. 22
0
 public Day16Fields(string name, RangeInt range1, RangeInt range2)
 {
     Name   = name;
     Range1 = range1;
     Range2 = range2;
 }
Esempio n. 23
0
 private void IncreaseWaveDifficulty_Internal(int waveCountIncrease)
 {
     _waveSize += waveCountIncrease;
 }
Esempio n. 24
0
 public abstract bool TryParse(string path, ref RangeInt cursor, out IWatchContext ctx);
Esempio n. 25
0
 public static int GetPseudoRandom2D(int input, int input2, RangeInt range)
 {
     return (int)(Math.Round(SimplexNoise.GetNoise(input, input2) * range.Max + range.Min));
 }
Esempio n. 26
0
 public static int SelectProperty(RangeInt range)
 {
     return(Random.Range(range.start, range.length));
 }
Esempio n. 27
0
 /// <summary>
 /// Initializes the grayscale filter based on the HSL structure.
 /// </summary>
 /// <param name="hue">Hue range [0, 359]</param>
 public HSLGrayscale(RangeInt hue)
 {
     Hue = hue;
 }
Esempio n. 28
0
 public Ruby(int textPosition, int textLength, RangeInt bodyStringRange)
 {
     this.textPosition    = textPosition;
     this.textLength      = textLength;
     this.bodyStringRange = bodyStringRange;
 }
Esempio n. 29
0
 public override void OnRetryExecuted()
 {
     _waveSize = new RangeInt(4, 8);
     Initialise();
 }
Esempio n. 30
0
    public void Generate()
    {
        gameObject.GetChildren().ForEach(child => Destroy(child));
        // Generate ground
        var ground = Instantiate(GroundPrefab, Vector3.zero, Quaternion.identity);

        //ground.transform.localScale = new Vector3(Width / 10, 1, Height / 10);
        //this.NextFrame(() => ground.transform.localScale = new Vector3(Width / 10, 1, Height / 10));
        SceneManager.MoveGameObjectToScene(ground, gameObject.scene);
        ground.transform.parent = transform;
        //ground.GetComponent<MeshCollider>().

        // Generate doors
        for (var i = 0; i < 4; i++)
        {
            Doors[i] = false;
            if (UnityEngine.Random.value < DoorProbability)
            {
                Doors[i] = true;
            }
        }
        if (InDoor != Orientation.None)
        {
            Doors[(int)InDoor] = true;
        }

        var wallNorth = GenerateWall(NorthDoor, Width);

        wallNorth.transform.parent   = gameObject.transform;
        wallNorth.transform.position = new Vector3(0, 0, Height / 2);
        wallNorth.transform.rotation = Quaternion.FromToRotation(Vector3.right, Vector3.forward);

        /*var wallSouth = GenerateWall(SouthDoor, Width);
         * wallSouth.transform.parent = gameObject.transform;
         * wallSouth.transform.position = new Vector3(0, 0, -Height / 2);
         * wallSouth.transform.rotation = Quaternion.FromToRotation(Vector3.right, Vector3.back);*/

        var wallEast = GenerateWall(EastDoor, Height);

        wallEast.transform.parent   = gameObject.transform;
        wallEast.transform.position = new Vector3(Width / 2, 0, 0);
        wallEast.transform.rotation = Quaternion.FromToRotation(Vector3.right, Vector3.right);

        var wallWest = GenerateWall(WestDoor, Height);

        wallWest.transform.parent   = gameObject.transform;
        wallWest.transform.position = new Vector3(-Width / 2, 0, 0);
        wallWest.transform.rotation = Quaternion.FromToRotation(Vector3.right, Vector3.left);

        // Generate map nodes
        mapSizeX   = Mathf.CeilToInt((Width / 2 - NodeSize / 2) / NodeSize) * 2 + 1;
        mapOffsetX = mapSizeX / 2;
        mapSizeY   = Mathf.CeilToInt((Height / 2 - NodeSize / 2) / NodeSize) * 2 + 1;
        mapOffsetY = mapSizeY / 2;
        map        = new MapNode[mapSizeX, mapSizeY];
        RangeX     = new RangeInt(
            Mathf.FloorToInt((-Width / 2 + NodeSize / 2) / NodeSize),
            Mathf.FloorToInt((Width / 2 + NodeSize / 2) / NodeSize)
            );
        RangeY = new RangeInt(
            Mathf.FloorToInt((-Height / 2 + NodeSize / 2) / NodeSize),
            Mathf.FloorToInt((Height / 2 + NodeSize / 2) / NodeSize)
            );
        // Init map nodes
        for (var y = 0; y < mapSizeY; y++)
        {
            for (var x = 0; x < mapSizeX; x++)
            {
                map[x, y] = new MapNode()
                {
                    Type = MapNodeType.Empty
                }
            }
        }
        ;
        ForEach((node, x, y) =>
        {
            if (y == RangeY.start || y == RangeY.end || x == RangeX.start || x == RangeX.end)
            {
                node.Type = MapNodeType.Wall;
            }
            node.Center = new Vector3(x * NodeSize, 0, y * NodeSize);
        });

        // Generate obstacles
        var obstacleCount = Mathf.FloorToInt(GenerateObstacle * Mathf.Sqrt(UnityEngine.Random.value));

        GetNodes()
        .Where(node => node.Type == MapNodeType.Empty)
        .RandomTake(obstacleCount)
        .ForEach(node =>
        {
            var obstacle = Utility.Instantiate(
                Obstacles
                .WeightedRandomTake(1)
                .Select(item => item.Object as GameObject)
                .FirstOrDefault(),
                gameObject);

            obstacle.transform.position = node.Center;
            node.Type = MapNodeType.Obstacle;
        });

        Generated = true;
    }
Esempio n. 31
0
 public Shape(ShapeType type, RangeInt pointRange = default, Rect bounds = default)
 {
     this.type       = type;
     this.pointRange = pointRange;
     this.bounds     = bounds;
 }
Esempio n. 32
0
        public bool _canTheseHorizontalVectorsExistTogether(WordVector _a, WordVector _b)
        {
            //check this to eliminate many checks later
            if ((Parallel_Rule == WordPlacement_Parallel_Rules.EvenLinesOnly) &&
                (((_a.Y % 2) == 1) || ((_b.Y % 2) == 1)))
            {
                return(false);
            }

            //a is the left most
            bool       swap = (_a.Pos.X > _b.Pos.X);
            WordVector a    = swap ? _b : _a;
            WordVector b    = swap ? _a : _b;

            RangeInt aRange = RangeInt.FromStartAndLength(a.Pos.X, a.Length);
            RangeInt bRange = RangeInt.FromStartAndLength(b.Pos.X, b.Length);

            //rule out vectors not near each other to eliminate many checks later
            RangeInt aRangePlus = RangeInt.FromStartAndLength(a.Pos.X, a.Length + 1);
            RangeInt bRangePlus = RangeInt.FromStartAndLength(b.Pos.X, b.Length + 1);

            if (!aRangePlus.Intersects(bRangePlus))
            {
                return(true); //no reason to test
            }

            if (a.Pos.Y == b.Pos.Y)
            {
                //run on rules apply
                switch (RunOnRule)
                {
                case WordPlacement_RunOn_Rules.NoRestrictions:
                    return(true);

                case WordPlacement_RunOn_Rules.NoContainment:
                    return(!(aRange.Contains(bRange) || bRange.Contains(aRange)));

                case WordPlacement_RunOn_Rules.NoRunOnOverLap:
                    return(!aRange.Intersects(bRange));

                case WordPlacement_RunOn_Rules.NoRunOnTouching:
                    return(false);     //because of previous tests we know they must at least but together

                default:
                    throw new InvalidOperationException();
                }
            }
            else if (Math.Abs(a.Pos.Y - b.Pos.Y) == 1)
            {
                //parallel rules apply
                switch (Parallel_Rule)
                {
                case WordPlacement_Parallel_Rules.NoRestrictions:
                    return(true);

                case WordPlacement_Parallel_Rules.MustHaveGap:
                    return(false);

                case WordPlacement_Parallel_Rules.EvenLinesOnly:
                    return(true);    //previous testing has already solved the case for false

                default:
                    throw new InvalidOperationException();
                }
            }
            else
            {
                //they are not near each other vertically
                return(true);
            }
        }
Esempio n. 33
0
        public IRequestToken LoadScores(LeaderboardScope leaderboardScope, RangeInt scoreRange, uint mode, ScoreloopCallback<LeaderboardScoresResponse> callback)
        {
            if (!this.IsNetworkAvailable)
            {
                callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(null, null, false));
                return null;
            }

            Ensure.True(scoreRange.Length > 0);

            IScoresController scoresController = _client.CreateScoresController();
            scoresController.RequestCancelled += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(null, scoresController, false));
            scoresController.RequestFailed += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(null, scoresController, false));
            scoresController.ScoresLoaded += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(new LeaderboardScoresResponse(e.Controller.Scores, scoreRange.Min), scoresController, true));

            scoresController.LoadScores(ScoreloopHelper.GetSearchList(leaderboardScope, scoresController), new ScoreloopRange(scoreRange.Min, (uint)scoreRange.Length), mode);
            return new RequestToken(scoresController);
        }
Esempio n. 34
0
    void Awake()
    {
        if (myTileScriptable != null)
        {
            myLocationID      = myTileScriptable.locationID;
            mySettlementIndex = myTileScriptable.settlementIndex;

            locationText          = myTileScriptable.locationText;
            encounterOptionText1  = myTileScriptable.encounterText1;
            encounterOptionIndex1 = myTileScriptable.encounterIndex1;
            encounterOptionText2  = myTileScriptable.encounterText2;
            encounterOptionIndex2 = myTileScriptable.encounterIndex2;
            encounterOptionText3  = myTileScriptable.encounterText3;
            encounterOptionIndex3 = myTileScriptable.encounterIndex3;
            encounterOptionText4  = myTileScriptable.encounterText4;
            encounterOptionIndex4 = myTileScriptable.encounterIndex4;
            addSkillToAction      = myTileScriptable.actionAddsSkill;

            if (myTileScriptable.exploreHasMultipleRanges)
            {
                exploreHasMultipleRanges = myTileScriptable.exploreHasMultipleRanges;
                howManyRanges            = myTileScriptable.howManyRanges;

                if (howManyRanges > 0)
                {
                    exploreRange1      = new RangeInt(myTileScriptable.range1Min, myTileScriptable.range1Length);
                    range1FurtherIndex = myTileScriptable.range1FurtherIndex;
                }

                if (howManyRanges > 1)
                {
                    exploreRange2      = new RangeInt(myTileScriptable.range2Min, myTileScriptable.range2Length);
                    range2FurtherIndex = myTileScriptable.range2FurtherIndex;
                }

                if (howManyRanges > 2)
                {
                    exploreRange3      = new RangeInt(myTileScriptable.range3Min, myTileScriptable.range3Length);
                    range3FurtherIndex = myTileScriptable.range3FurtherIndex;
                }
                if (howManyRanges > 3)
                {
                    exploreRange4      = new RangeInt(myTileScriptable.range4Min, myTileScriptable.range4Length);
                    range4FurtherIndex = myTileScriptable.range4FurtherIndex;
                }

                rangeFailMeansMoveOn     = myTileScriptable.rangeFailMeansMoveOn;
                canGetLost               = myTileScriptable.canGetLost;
                randomDirectionChoiceMax = myTileScriptable.randomDirectionRangeMax;

                //rangeFailMeansDie = myTileScriptable.rangeFailMeansGameOver;
            }

            hasCombat = myTileScriptable.combatHere;

            if (myTileScriptable.merchantHere)
            {
                myMerchant = myTileScriptable.myMerchantScriptable;
            }

            canMoveOn = myTileScriptable.canMoveOn;

            timeTaken          = myTileScriptable.timeTaken;
            secondaryTimeTaken = myTileScriptable.timeTakenSecondary;
            canRestAtNight     = myTileScriptable.canRestAtNight;

            timeLocked    = myTileScriptable.timeLocked;
            daysLimit1    = myTileScriptable.daysLimit1;
            timeLimit1    = myTileScriptable.timeLimit1;
            limit1Index   = myTileScriptable.limit1Index;
            daysLimit2    = myTileScriptable.daysLimit2;
            timeLimit2    = myTileScriptable.timeLimit2;
            limit2Index   = myTileScriptable.limit2Index;
            overTimeIndex = myTileScriptable.overTimeIndex;

            XPGained = myTileScriptable.experience;

            changesPlayerLocation = myTileScriptable.changesPlayerLocation;
            changedLocationID     = myTileScriptable.changedLocationID;

            previousLocationsConsidered = myTileScriptable.previousLocationsConsidered;
            locationsConsidered         = myTileScriptable.locationsConsidered;
            locationBasedEncounter      = myTileScriptable.locationBasedEncounter;
            alternateLocationEncounter  = myTileScriptable.alternateLocationEncounter;

            downstreamSameSideTile1ID  = myTileScriptable.riverSameSideTile1ID;
            downstreamSameSideTile2ID  = myTileScriptable.riverSameSideTile2ID;
            downstreamOtherSideTile1ID = myTileScriptable.riverOtherSideTile1ID;
            downstreamOtherSideTile2ID = myTileScriptable.riverOtherSideTile2ID;
        }
    }