コード例 #1
0
ファイル: GridInspector.cs プロジェクト: Xylord/Project-Feels
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        grid = target as LevelGrid;

        EditorGUI.BeginChangeCheck();

        if (GUILayout.Button("Generate Empty Grid"))
        {
            Undo.RecordObject(grid, "Generate Empty Grid");
            grid.GenerateEmptyGridEditor();
            EditorUtility.SetDirty(grid);
        }

        if (GUILayout.Button("Clear Grid"))
        {
            Undo.RecordObject(grid, "Clear Grid");
            grid.ClearGridEditor();
            EditorUtility.SetDirty(grid);
        }

        if (GUILayout.Button("Update Grid"))
        {
            Undo.RecordObject(grid, "Update Grid");
            grid.UpdateGrid();
            EditorUtility.SetDirty(grid);
        }
    }
コード例 #2
0
    public bool SetStartPoint(string objPath, string basePath, Direction dir)
    {
        LevelGrid grid = GetGrid(dir);

        //check allowed to spawn
        GameObject obj = Resources.Load <GameObject>(objPath + "obj");

        if (!obj.GetComponent <StartPoint>().directionAllowedSpawn[(int)dir - 1])
        {
            return(false);
        }

        //first check if need to set sprayable or remove formal object
        if (!grid.isSprayable())
        {
            SetSprayable(true, dir);
        }
        else
        {
            if (grid.type == GridType.START)
            {
                if (grid.objectBaseFilePath == basePath && grid.objectFilePath == objPath)
                {
                    return(true);
                }
                else
                {
                    RemoveObject(dir);
                }
            }
            else
            {
                RemoveObject(dir);
            }
        }


        //Set new one!
        grid.SetStartPoint(obj, objPath, basePath);
        for (int i = 1; i <= 4; i++)
        {
            if (grid.IsConnecting((Direction)i))
            {
                LevelGrid nearGrid = grid.GetNearGrid((Direction)i);
                if (nearGrid.GetObjectType() == grid.GetObjectType())
                {
                    Direction relativeDir = GetRelativeDirection(dir, (Direction)i, grid.GetHeight((Direction)i));
                    grid.SetObjectConnection((Direction)i, true);
                    nearGrid.SetObjectConnection(relativeDir, true);
                    nearGrid.UpdateAllVisual(0);
                }
            }
        }
        grid.UpdateAllVisual(2);

        return(true);
    }
コード例 #3
0
 public void ResizeSprite()
 {
     if (gameObject.GetComponent <SpriteRenderer>().sprite != null)
     {
         transform.localScale = new Vector3((transform.localScale.x * (LevelGrid.GetTileSize().x / gameObject.GetComponent <SpriteRenderer>().bounds.size.x)),
                                            (transform.localScale.y * (LevelGrid.GetTileSize().y / gameObject.GetComponent <SpriteRenderer>().bounds.size.y)),
                                            transform.localScale.z);
     }
 }
コード例 #4
0
    void Init()
    {
        LevelGrid lg = (LevelGrid)target;

        myTarget   = new UnityEditor.SerializedObject(lg);
        levels     = myTarget.FindProperty("levels");
        dimensions = myTarget.FindProperty("dimensions");
        Dimensions = dimensions.vector2IntValue;
    }
コード例 #5
0
    private void Start()
    {
        Timer t = new Timer();

        levelGrid = new LevelGrid(35, 24);

        snake.Setup(levelGrid);
        levelGrid.Setup(snake);
    }
コード例 #6
0
ファイル: GameHandler.cs プロジェクト: NeiLip/CustomSnake
    private void Start()
    {
        Debug.Log("GameHandler.Start");

        levelGrid = new LevelGrid(20, 20);

        snake.Setup(levelGrid);
        levelGrid.Setup(snake);
    }
コード例 #7
0
    public void AddBlockTo(Direction dir, PuzzleBlock newBlock)             //add block to one direction
    {
        LevelGrid grid         = GetGrid(dir);                              //Get grid
        LevelGrid coveringGrid = newBlock.GetGrid(GetOpposeDirection(dir)); //also get covering grid

        SetSprayable(false, dir);                                           //This Grid is Not Sprayable Any More!
        newBlock.SetSprayable(false, GetOpposeDirection(dir));              //set covering grid to not sprayable
        grid.SetCoveringGrid(coveringGrid);
        coveringGrid.SetCoveringGrid(grid);

        for (int i = 1; i <= 4; i++)   // Change All Nearby Grid And Status
        {
            //Get near Grid and new Grid
            LevelGrid nearGrid = grid.GetNearGrid((Direction)i);
            if (nearGrid == null)//this situation only happen when processing multiple covered grid
            {
                continue;
            }

            LevelGrid newGrid = newBlock.GetSelfRelativeDirectionGrid(dir, (Direction)i);

            //Get height status
            int height = grid.GetHeight((Direction)i);
            //Get Relative Direction
            Direction nearGridRelativeDirection = GetRelativeDirection(dir, (Direction)i, height);
            Direction newGridRelativeDirection;
            //Change nearby grids status
            if (height < 2)
            {
                int h = nearGrid.AddHeight(nearGridRelativeDirection, 1); // Change near grid height Status
                newGridRelativeDirection = GetRelativeDirection(nearGrid.direction, nearGridRelativeDirection, nearGrid.GetHeight(nearGridRelativeDirection));
                newGrid.SetHeight(newGridRelativeDirection, h);           //Also Change new grid height status = near grid height status
                nearGrid.SetNearGrid(newGrid, nearGridRelativeDirection); //Set new Nearby Grid
                newGrid.SetNearGrid(nearGrid, newGridRelativeDirection);  // Set new Nearby Grid
            }
            else//if height = 2, it means this grid is covered too.
            {
                newGridRelativeDirection = GetRelativeDirection(nearGrid.direction, nearGridRelativeDirection, nearGrid.GetHeight(nearGridRelativeDirection));
                nearGrid.block.SetSprayable(false, nearGrid.direction); // Change status to not sprayable
                nearGrid.SetCoveringGrid(newGrid);
                nearGrid.SetNearGrid(null, nearGridRelativeDirection);  //set to null
                newGrid.SetCoveringGrid(nearGrid);
                newGrid.SetNearGrid(null, newGridRelativeDirection);
            }
            //clear grid and covering grid connection
            grid.SetConnection((Direction)i, false);
            grid.SetNearGrid(null, (Direction)i);
            coveringGrid.SetNearGrid(null, (Direction)i);
            //also delete the connection of near grid
            nearGrid.SetConnection(nearGridRelativeDirection, false);
            nearGrid.UpdateAllVisual(0);
            newGrid.UpdateAllVisual(0);
        }

        grid.UpdateAllVisual(0);
        coveringGrid.UpdateAllVisual(0);
    }
コード例 #8
0
ファイル: GameHandler.cs プロジェクト: Pelityypit/Unity
 private void Start()
 {
     levelGrid = new LevelGrid(-20, 20, -15, 15); // Luo rajat
     snake.Setup(levelGrid);
     SpawnSpeedBoostObj.GetComponent <SpawnSpeedBoost>().SpawnSpeedBoostTime();
     spawnEscapeDeathObj.GetComponent <SpawnEscapeDeath>().SpawnEscapeDeathTime();
     spawnBombObj.GetComponent <SpawnBomb>().SpawnBombTime();
     spawnFoodObj.GetComponent <SpawnFood>().SpawnFoods();
     spawnQuestionObj.GetComponent <SpawnQuestionMark>().SpawnQuestionMarkTime();
 }
コード例 #9
0
    //set tile
    public override void InitializeTile()
    {
        base.InitializeTile();

        LevelGrid levelGrid = GameWorld.GetObject("levelgrid") as LevelGrid;

        origin = new Vector2(Width / 2, sprite.Height - levelGrid.CellHeight / 2 - 1);

        SetBoundingBox();
    }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        m_player      = Instantiate <Player> (playerPrefab);
        m_player.name = "Player";

        m_grid = FindObjectOfType <LevelGrid> ();
        LoadLevels(levelFilename);

        ActiveLevel = 0;
    }
コード例 #11
0
    void Start()
    {
        gameAsset = GameAsset.Instance;
        levelGird = new LevelGrid(9, 19);
        levelGird.GameSetup(gameAsset.snakePrefab);
        StartCoroutine(GameCondition());
#if UNITY_ANDROID || UNITY_IOS
        AssignMobileController();
#endif
    }
コード例 #12
0
 private void Awake()
 {
     gridPosition         = new Vector2Int(10, 10);
     gridMoveTimerMax     = 0.1f;
     gridMoveTimer        = gridMoveTimerMax;
     gridMoveDirection    = new Vector2Int(1, 0);
     movePositionGridList = new List <Vector2Int>();
     state     = State.Alive;
     levelGrid = new LevelGrid(20, 20);
 }
コード例 #13
0
    public override void OnAddToLevel(LevelGrid grid, GridCoord position)
    {
        // Try to link to an unused trigger.
        TriggeredPlatformSquare trigger = FindUnusedTriggeredPlatformSquare(grid);

        if (trigger != null)
        {
            triggerSquare = trigger;
            triggerSquare.toggleSquare = this;
        }
    }
コード例 #14
0
 /* Work out if we have any neighbours */
 public bool HasNeighbours(LevelGrid playspace)
 {
     foreach (Tile nTile in playspace.GetTileNeighbours(this))
     {
         if (nTile != null && nTile._isOccupied)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #15
0
    }//获得玩家当前使用的颜色

    public void SetGun(bool b)
    {
        if (hasGun != b)
        {
            hasGun = b;
            highlight.SetActive(b);
            selectingGrid = null;
            //selectingCube = null;
            renderer.enabled = b;
        }
    }//打开或关闭枪
コード例 #16
0
ファイル: GridSplitter.cs プロジェクト: YumiiK/Regrass
    private void FindNearGridOnDirection(LevelGrid grid, NearGridDirection dir)
    {
        int        layerMask = 1 << 9 | 1 << 10;
        RaycastHit hit;
        Vector3    raycastPos = grid.position + 0.5f * grid.direction;
        Quaternion rotation   = Quaternion.FromToRotation(Vector3.up, grid.direction);
        Vector3    direction  = Vector3.back;

        switch (dir)
        {
        case NearGridDirection.BACK:
        {
            direction = Vector3.back;
            break;
        }

        case NearGridDirection.FORWARD:
        {
            direction = Vector3.forward;
            break;
        }

        case NearGridDirection.LEFT:
        {
            direction = Vector3.left;
            break;
        }

        case NearGridDirection.RIGHT:
        {
            direction = Vector3.right;
            break;
        }
        }

        if (Physics.Raycast(raycastPos, rotation * direction, out hit, 1f, layerMask))
        {
            GridSplitter cube = hit.collider.GetComponent <GridSplitter>();
            grid.SetNearGrid(cube.GetGridAtPosition(hit.point), dir);
            //grid.setDebugInfo(raycastPos, hit.point, dir);
        }
        else if (Physics.Raycast(raycastPos, grid.position + rotation * direction - raycastPos, out hit, 2f, layerMask))
        {
            GridSplitter cube = hit.collider.GetComponent <GridSplitter>();
            grid.SetNearGrid(cube.GetGridAtPosition(hit.point), dir);
            //grid.setDebugInfo(raycastPos, hit.point, dir);
        }
        else if (Physics.Raycast(raycastPos - grid.direction + rotation * direction, rotation * ((-1) * direction), out hit, 1f, layerMask))
        {
            GridSplitter cube = hit.collider.GetComponent <GridSplitter>();
            grid.SetNearGrid(cube.GetGridAtPosition(hit.point), dir);
            //grid.setDebugInfo(raycastPos - grid.direction + rotation * direction, hit.point, dir);
        }
    }
コード例 #17
0
    public bool ProbeForObject(Direction ori, Direction dir1, Direction dir2, string type)
    {
        LevelGrid grid = GetGrid(ori);
        bool      ret  = false;
        //d1 = smaller one, d2 = bigger one
        Direction d1, d2;

        if (LoopAdd((int)dir1, 1, 1, 4) == (int)dir2)
        {
            d1 = dir1;
            d2 = dir2;
        }
        else
        {
            d1 = dir2;
            d2 = dir1;
        }

        LevelGrid lastGrid   = grid;
        LevelGrid probeGrid  = grid.GetNearGrid(d1);
        LevelGrid targetGrid = grid.GetNearGrid(d2);

        Direction lastDirection  = ori;
        Direction probeDirection = d1;

        int probeAdd = -1;

        if (grid.direction == Direction.DOWN || lastGrid.direction == Direction.DOWN)
        {
            probeAdd = 1;
        }

        for (int i = 0; i < 3; i++)
        {
            Debug.Log(i);
            probeDirection = GetRelativeDirection(lastDirection, probeDirection, lastGrid.GetHeight(probeDirection));
            probeDirection = (Direction)LoopAdd((int)probeDirection, probeAdd, 1, 4);
            if (!probeGrid.IsConnecting(probeDirection) || probeGrid.GetObjectType() != type)
            {
                ret = false;
                break;
            }
            lastGrid      = probeGrid;
            lastDirection = lastGrid.direction;
            probeGrid     = lastGrid.GetNearGrid(probeDirection);
            if (probeGrid == targetGrid)
            {
                ret = true;
                break;
            }
        }
        //Debug.Log($"[Function]{name}ProbeForWater({ori},{dir1},{dir2}) = {ret}");
        return(ret);
    }
コード例 #18
0
    public override void OnAddToLevel(LevelGrid grid, GridCoord position)
    {
        // Try to link to an unused toggle.
        ToggleTriggerPlatformSquare toggle = FindUnusedToggleTriggerPlatformSquare(grid);

        if (toggle != null)
        {
            toggleSquare = toggle;
            toggleSquare.triggerSquare = this;
        }
    }
コード例 #19
0
    public void GenerateBlood(LevelGrid grid, Vector3 playerTransform)
    {
        Vector3 bloodRotation = Vector3.zero;
        float   extraRotation = Random.Range(-90, 90);

        switch (CameraMovement.Lateral)
        {
        case CameraMovement.Axes.xNeg: bloodRotation = new Vector3(extraRotation, 90, 0); break;

        case CameraMovement.Axes.xPos: bloodRotation = new Vector3(extraRotation, -90, 0); break;

        case CameraMovement.Axes.yNeg: bloodRotation = new Vector3(-90, extraRotation, 0); break;

        case CameraMovement.Axes.yPos: bloodRotation = new Vector3(90, extraRotation, 0); break;

        case CameraMovement.Axes.zNeg: bloodRotation = new Vector3(0, 0, extraRotation); break;

        case CameraMovement.Axes.zPos: bloodRotation = new Vector3(180, 0, extraRotation); break;
        }

        Vector3 belowPos = Vector3.zero;

        switch (CameraMovement.Lateral)
        {
        case CameraMovement.Axes.xNeg: belowPos = new Vector3(1, 0, 0); break;

        case CameraMovement.Axes.xPos: belowPos = new Vector3(-1, 0, 0); break;

        case CameraMovement.Axes.yNeg: belowPos = new Vector3(0, 1, 0); break;

        case CameraMovement.Axes.yPos: belowPos = new Vector3(0, -1, 0); break;

        case CameraMovement.Axes.zNeg: belowPos = new Vector3(0, 0, 1); break;

        case CameraMovement.Axes.zPos: belowPos = new Vector3(0, 0, -1); break;
        }

        GameObject boodInstance = Instantiate(blood, grid.GetCellInWorldPosition(playerTransform).globalPosition + belowPos / 2.01f, Quaternion.Euler(bloodRotation.x, bloodRotation.y, bloodRotation.z));

        switch (CameraMovement.Lateral)
        {
        case CameraMovement.Axes.xPos: boodInstance.transform.parent = right.transform; break;

        case CameraMovement.Axes.yNeg: boodInstance.transform.parent = top.transform; break;

        case CameraMovement.Axes.yPos: boodInstance.transform.parent = down.transform; break;

        case CameraMovement.Axes.zNeg: boodInstance.transform.parent = front.transform; break;

        case CameraMovement.Axes.zPos: boodInstance.transform.parent = bottom.transform; break;

        case CameraMovement.Axes.xNeg: boodInstance.transform.parent = left.transform; break;
        }
    }
コード例 #20
0
    private void Start()
    {
        grid = FindObjectOfType <LevelGrid>();

        GridTile[] gridTiles = grid.GroundTiles;

        for (int i = 0; i < gridTiles.Length; i++)
        {
            levelTiles.Add(gridTiles[i].GetInstanceID(), gridTiles[i]);
        }
    }
コード例 #21
0
    private void Start()
    {
        levelGrid = new LevelGrid(20, 20);

        snake.Setup(levelGrid);
        levelGrid.Setup(snake);

        //GameObject snakeHeadGameObject = new GameObject();
        //SpriteRenderer snakeSpriteRenderer = snakeHeadGameObject.AddComponent<SpriteRenderer>();
        //snakeSpriteRenderer.sprite = GameAssets.instance.snakeHeadSprite;
    }
コード例 #22
0
        private IEnumerator LeapRoutine(Vector2Int target, float delay)
        {
            yield return(new WaitForSeconds(delay));

            GridPosition = target;
            var targetPosition = LevelGrid.ToWorldCoordinates(target.x, target.y);

            transform.DOJump(targetPosition, 0.25f, 1, 0.3f).SetEase(Ease.InQuint);
            Renderer.sortingOrder = LevelGrid.GetSortingOrder(target.x, target.y);
            audio.PlayMove();
        }
コード例 #23
0
    public Tile LoadPlayer(int x, int y)
    {
        LevelGrid      tiles    = GetObject("tiles") as LevelGrid;
        Player         player   = new Player();
        GameObjectList entities = GetObject("entities") as GameObjectList;

        entities.Add(player);
        player.MovePositionOnGrid(x, y);
        //return new Tile(new Point(x, y), "Sprites/Tiles/spr_floor_sheet_test_1@4x4", TileType.Floor, TextureType.Grass);
        return(new Tile(new Point(x, y), "Sprites/Tiles/spr_grass_sheet_0@4x4", TileType.Floor, TextureType.Grass));
    }
コード例 #24
0
    private void Awake()
    {
        floor      = FindObjectOfType <Level>().Grid;
        wallParent = new GameObject("Walls").transform;

        Wall1         = Resources.Load <GameObject>("Prefabs/Walls/Wall_1");
        Wall2Corner   = Resources.Load <GameObject>("Prefabs/Walls/Wall_2_corner");
        Wall2Straight = Resources.Load <GameObject>("Prefabs/Walls/Wall_2_straight");
        Wall3         = Resources.Load <GameObject>("Prefabs/Walls/Wall_3");
        Wall4         = Resources.Load <GameObject>("Prefabs/Walls/Wall_4");
    }
コード例 #25
0
ファイル: EntityPhysics.cs プロジェクト: nasr250/Valkan
    private void OutsideLevel()
    {
        LevelGrid tiles       = GameWorld.GetObject("levelgrid") as LevelGrid;
        Vector2   loc         = tiles.GridPosition(position);
        Tile      currentTile = tiles.Get((int)loc.X, (int)loc.Y) as Tile;

        if (currentTile == null)
        {
            RemoveSelf();
        }
    }
コード例 #26
0
    public LevelEditorTool(ArkanoidManager arkanoidManager)
    {
        _arkanoidManager = arkanoidManager;

        _grid                            = new LevelGrid(_arkanoidManager);
        _bricksPrefabs                   = Utils.GetPrefabsAtPath(Utils.BricksPath);
        _backGroundMaterials             = Utils.GetBackGroundMaterialsAtPath(Utils.BackgroundMaterialsPath);
        _selectedPrefabIndex             = EditorPrefs.GetInt("_selectedPrefabIndex", -1);
        _selectedBackgroundMaterialIndex = EditorPrefs.GetInt("_selectedBackgroundMaterialIndex", -1);

        LoadEditor();
    }
コード例 #27
0
ファイル: EnemySpawner.cs プロジェクト: VeRTeXR/SnakeRPG
        public void Setup(CaravanController caravanController, LevelGrid levelGrid)
        {
            _caravanController = caravanController;
            var levelDimension = levelGrid.GetLevelDimension();

            _levelGrid    = levelGrid;
            _levelWidth   = levelDimension.x;
            _levelHeight  = levelDimension.y;
            _currentTimer = _maxTimer;

            _isTimerActive = true;
        }
コード例 #28
0
    public Tile LoadItem(int x, int y)
    {
        LevelGrid      tiles    = GetObject("tiles") as LevelGrid;
        Item           item     = new Item();
        GameObjectList entities = GetObject("entities") as GameObjectList;
        GameObjectList items    = GetObject("items") as GameObjectList;

        items.Add(item);
        item.MovePositionOnGrid(x, y);
        //return new Tile(new Point(x, y), "Sprites/Tiles/spr_floor_sheet_test_1@4x4", TileType.Floor, TextureType.Grass);
        return(new Tile(new Point(x, y), "Sprites/Tiles/spr_grass_sheet_0@4x4", TileType.Floor, TextureType.Grass));
    }
コード例 #29
0
    private void Start()
    {
        Debug.Log("GameHandler.Start");

        // instantiating our level grid
        levelGrid = new LevelGrid(60, 60);
        // calling the snake setup function
        // passing in the level grid
        snake.Setup(levelGrid);
        // calling setup and passing in the snake reference
        levelGrid.Setup(snake);
    }
コード例 #30
0
ファイル: EntityPhysics.cs プロジェクト: nasr250/Valkan
    protected virtual void HandleCollisions()
    {
        LevelGrid tiles = GameWorld.GetObject("levelgrid") as LevelGrid;

        //check surrounding tiles
        for (int x = (int)gridPos.X - 2; x <= (int)gridPos.X + 2; x++)
        {
            for (int y = (int)gridPos.Y - 2; y <= (int)gridPos.Y + 2; y++)
            {
                TileType tileType    = tiles.GetTileType(x, y);
                Tile     currentTile = tiles.Get(x, y) as Tile;

                Vector2   tilePos = new Vector2(x * tiles.CellWidth / 2 - tiles.CellWidth / 2 * y, y * tiles.CellHeight / 2 + tiles.CellHeight / 2 * x);
                Rectangle tileBounds;
                if (currentTile == null)
                {
                    tileBounds = new Rectangle((int)(tilePos.X - tiles.CellWidth / 2), (int)(tilePos.Y - tiles.CellHeight / 2), tiles.CellWidth, tiles.CellHeight);
                }
                else
                {
                    for (int i = 0; i < currentTile.Passengers.Count; i++)
                    {
                        if (currentTile.Passengers[i] != id)
                        {
                            //check tile passenger collision
                            HandleEntityCollisions(currentTile.Passengers[i]);
                        }
                    }
                    //check collision
                    if (tileType == TileType.Floor)
                    {
                        continue;
                    }
                    tileBounds = currentTile.GetBoundingBox();
                }

                if (!tileBounds.Intersects(BoundingBox))
                {
                    continue;
                }

                //mouve position
                Vector2 depth = Collision.CalculateIntersectionDepth(BoundingBox, tileBounds);
                if (Math.Abs(depth.X) < Math.Abs(depth.Y))
                {
                    position.X += depth.X;
                    continue;
                }
                position.Y += depth.Y;
            }
        }
    }
コード例 #31
0
        private IEnumerator MoveRoutine(Action movingCompleted)
        {
            var targetPosition = LevelGrid.ToWorldCoordinates(GridPosition.x, GridPosition.y);
            var jumpDuration   = 0.3f;

            transform.DOJump(targetPosition, 0.25f, 1, jumpDuration).SetEase(Ease.InQuint);
            Renderer.sortingOrder = LevelGrid.GetSortingOrder(GridPosition.x, GridPosition.y);
            audio.PlayMove();

            yield return(new WaitForSeconds(jumpDuration));

            movingCompleted();
        }
コード例 #32
0
ファイル: AITurnManager.cs プロジェクト: Xylord/Project-Feels
 // Use this for initialization
 void Start()
 {
     grid = GameObject.Find("Grid").GetComponent<LevelGrid>();
     spawnedAIs = FindObjectsOfType(typeof(ComputerUnit)) as ComputerUnit[];
     spawnedPCs = FindObjectsOfType(typeof(PlayerCharacter)) as PlayerCharacter[];
     turnCount = 0;
 }
コード例 #33
0
 // Use this for initialization
 void Start()
 {
     this.grid = new LevelGrid(terrain);
     initGrid(staticObjects);
 }
コード例 #34
0
ファイル: MovementPlane.cs プロジェクト: Xylord/Project-Feels
 public void InitializeMovementPlane()
 {
     grid = GameObject.Find("Grid").GetComponent<LevelGrid>();
     transform.parent = grid.gameObject.transform;
     turnManager = GameObject.Find("AITurnManager").GetComponent<AITurnManager>();
 }
コード例 #35
0
ファイル: GameState.cs プロジェクト: RegrowthStudios/VoxelRTS
 // Create With Premade Data
 public void SetGrids(LevelGrid lg)
 {
     grid.InfoFile = lg.InfoFile;
     //grid.L0 = lg.L0;
     grid.L1 = lg.L1;
     grid.L2 = lg.L2;
 }
コード例 #36
0
ファイル: BasicTile.cs プロジェクト: Xylord/Project-Feels
    public void InitializeTile()
    {
        grid = GameObject.Find("Grid").GetComponent<LevelGrid>();
        heightVariationProgress = 0f;
        continuousHeight = presentHeight;
        characterStepping = null;
        isOccupied = false;

        randomHeightVariation = Random.Range(-randomHeightVariationRange, randomHeightVariationRange);

        if (isSpawn)
        {
            grid.spawnTiles.Add (this);
        }

        if (Application.isEditor)
        {
            int i = gameObject.transform.childCount;
            while (i > 0){
                DestroyImmediate(gameObject.transform.GetChild(0).gameObject);
                i--;
            }
        }
        else
        {
            if (gameObject.transform.childCount > 0)
                Destroy(gameObject.transform.GetChild(0).gameObject);
            if (gameObject.transform.childCount > 0)
                Destroy(gameObject.transform.GetChild(1).gameObject);
        }

        //foundation = Instantiate(grid.emptyTile);

        if (type == TileKind.Empty)
        {
            foundation = Instantiate(grid.emptyTile);
            foundation.name = "foundation";
            foundation.transform.parent = transform;
            foundation.transform.localPosition = Vector3.zero;
        }

        else if (type == TileKind.Flat)
        {
            foundation = Instantiate(grid.foundation);
            foundation.name = "foundation";
            foundation.transform.parent = transform;
            foundation.transform.localPosition = Vector3.zero;
            //foundation.GetComponent<MeshRenderer>().material = grid.tileMaterials[1];
        }

        else if (type == TileKind.Stair)
        {
            top = Instantiate(grid.stair);
            top.name = "top";
            top.transform.parent = transform;
            top.transform.localPosition = Vector3.zero;

            foundation = Instantiate(grid.foundation);
            foundation.name = "foundation";
            foundation.transform.parent = transform;
            foundation.transform.localPosition = Vector3.zero;
            foundation.transform.localPosition = new Vector3(0f, -0.5f, 0f);
            top.transform.localPosition = new Vector3(0f, 0.25f, 0f);

            switch (orientation)
            {
                case Orientation.Forward:
                    top.transform.localRotation = Quaternion.Euler(0f, 270f, 0f);
                    break;

                case Orientation.Backward:
                    top.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
                    break;

                case Orientation.Right:
                    top.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
                    break;

                case Orientation.Left:
                    top.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
                    break;

                case Orientation.Directionless:
                    top.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
                    break;
            }
        }
    }
コード例 #37
0
ファイル: MapParser.cs プロジェクト: RegrowthStudios/VoxelRTS
 public TerrainData()
 {
     Regions = new List<ImpactRegion>();
     LGrid = new LevelGrid();
 }
コード例 #38
0
 // Use this for initialization
 void Start()
 {
     grid = GameObject.Find("Grid").GetComponent<LevelGrid>();
     transform.parent = grid.gameObject.transform;
 }
コード例 #39
0
ファイル: GameState.cs プロジェクト: RegrowthStudios/VoxelRTS
        public GameState()
        {
            UUIDGenerator.SetUUID(0);
            EntityHashSet = new Dictionary<int, IEntity>();

            teams = new RTSTeam[MAX_PLAYERS];
            activeTeams = new IndexedTeam[0];
            Regions = new List<ImpactRegion>();

            // No Data Yet Available
            VoxState = new VoxState();
            VoxState.World.worldMin = Point.Zero;
            Scripts = new Dictionary<string, ReflectedScript>();
            grid = new LevelGrid();
            //grid.L0 = null;
            grid.L1 = null;
            grid.L2 = null;

            curFrame = 0;
            timePlayed = 0f;

            tbMemBuildings = new TimeBudget(BUILDING_MEMORIZATION_LATENCY);

            lckParticles = new object();
            particles = new List<Particle>();
            tmpParticles = new List<Particle>();
        }