Exemple #1
0
 public TileData()
 {
     Height = 0;
     Type = ETileType.Grass;
     Redirect = null;
     Attachment = null;
 }
Exemple #2
0
    private void InitTileWithType(Tile pTile, ETileType eTileType)
    {
        pTile.SetTileType(eTileType);

        switch (eTileType)
        {
        case ETileType.PELLET:
            pTile.m_pPellet.m_pPickupEffect = m_pRegularPelletsEffect;
            break;

        case ETileType.SUPER_PELLET:
            pTile.m_pPellet.m_pPickupEffect = m_pSuperPelletsEffect;
            break;

        case ETileType.WARP:
            InitPortal(pTile);
            break;

        case ETileType.PACMAN_SPAWNER:
            GameManager.Instance.SetPlayerSpawnTile(pTile);
            break;

        case ETileType.GHOST_SPAWNER:
            GhostsManager.Instance.AddGhostSpawnTile(pTile);
            break;
        }
    }
Exemple #3
0
 public void SetTileChecked(BoardPoint position, ETileType tileType)
 {
     if (IsValidTile(position))
     {
         SetTile(position, tileType);
     }
 }
Exemple #4
0
    private void CreateTile(ETileType aType, Vector2 aSpawnPos)
    {
        switch (aType)
        {
        case ETileType.Floor:
            GameObject floor = Instantiate(m_FloorPrefabList[Random.Range(0, m_FloorPrefabList.Length)]);
            floor.transform.position = aSpawnPos;
            break;

        case ETileType.Wall:
            GameObject wall = Instantiate(m_WallPrefabList[Random.Range(0, m_WallPrefabList.Length)]);
            wall.transform.position = aSpawnPos;
            break;

        case ETileType.Random:
            int rand = Random.Range(0, 100);
            if (rand < 33)
            {
                GameObject wall1 = Instantiate(m_WallPrefab);
                wall1.transform.position = aSpawnPos;
            }
            else
            {
                GameObject floor1 = Instantiate(m_FloorPrefab);
                floor1.transform.position = aSpawnPos;
            }
            break;
        }
    }
Exemple #5
0
    public void SelectTileType(int number)
    {
        mTileType = (ETileType)number;
        string res = Tile.TILE_TEXTURE[mTileType];

        BoundBox.GetComponent <Image>().sprite = Resources.Load <Sprite>(res);
    }
Exemple #6
0
    private void CreateTile(ETileType aType, Vector2 aPos)
    {
        switch (aType)
        {
        case ETileType.Floor:
        {
            GameObject floor = Instantiate(m_FloorPrefabList[Random.Range(0, m_FloorPrefabList.Length)]);
            floor.transform.position = aPos;
            break;
        }

        case ETileType.Wall:
        {
            GameObject wall = Instantiate(m_WallPrefabList[Random.Range(0, m_WallPrefabList.Length)]);
            wall.transform.position = aPos;
            break;
        }

        case ETileType.Destructible:
        {
            GameObject destructible = Instantiate(m_DestructiblePrefabList[Random.Range(0, m_DestructiblePrefabList.Length)]);
            destructible.transform.position = aPos;
            break;
        }
        }
    }
    private Texture GetTileTexture(ETileType aTileType)
    {
        Texture image;

        switch (aTileType)
        {
        case ETileType.Wall:
        {
            image = m_WallTexture;
            break;
        }

        case ETileType.Floor:
        {
            image = m_FloorTexture;
            break;
        }

        case ETileType.Destructible:
        {
            image = m_BrickDestructibleTexture;
            break;
        }

        default:
        {
            image = m_FloorTexture;
            break;
        }
        }

        return(image);
    }
    ETileType ChooseTileType(int tileNumber)
    {
        // determine the tile type by working out complexity and what is nearby.
        // EASY:        tiles are mostly plain with 20% danger tiles - no jumps.
        // NORMAL:      tiles are mostly plain with a few jumps and 20% danger tiles.
        // MEDIUM:      tiles are a mix of plain and jumps with 33% danger tiles.
        // HARD:        tiles are a mix of plain and jumps with <=50% danger tiles.
        // SUPERHARD:   tiles are a mix of plain and jumps with many danger tiles (50%+)
        //

        ETileType vTileType = ETileType.plain;

        switch (tileComplexity)
        {
        case ETileComplexity.EASY:      vTileType = CalculateTileType(tileNumber, 80, 100); break;

        case ETileComplexity.NORMAL:    vTileType = CalculateTileType(tileNumber, 80, 95); break;

        case ETileComplexity.MEDIUM:    vTileType = CalculateTileType(tileNumber, 75, 95); break;

        case ETileComplexity.HARD:      vTileType = CalculateTileType(tileNumber, 66, 90); break;

        case ETileComplexity.SUPERHARD: vTileType = CalculateTileType(tileNumber, 40, 75); break;
        }
        return(vTileType);
    }
Exemple #9
0
    private GameObject CreateTile(ETileType aType, Vector2 aPos)
    {
        switch (aType)
        {
        case ETileType.Floor:
            GameObject floor = Instantiate(m_FloorPrefabList[Random.Range(0, m_FloorPrefabList.Length)]);
            floor.transform.position = aPos;
            return(floor);

        case ETileType.Wall:
            GameObject wall = Instantiate(m_WallPrefabList[Random.Range(0, m_WallPrefabList.Length)]);
            wall.transform.position = aPos;
            return(wall);

        case ETileType.Destructable:
            GameObject Destructable = Instantiate(m_DestructiblePrefabList[Random.Range(0, m_WallPrefabList.Length)]);
            Destructable.transform.position = aPos;
            return(Destructable);

        case ETileType.Trap:
            GameObject Trap = Instantiate(m_TrapPrefab);
            Trap.transform.position = aPos;
            return(Trap);
        }
        return(null);
    }
    private GameObject GetTile(ETileType eTileType, float x, float y)
    {
        // Depending on the type of tile - instantiate prefabs that refer to each tile type at the location speficifed.
        GameObject        gameObject = null;
        int               jumpHeight;
        List <GameObject> objectList = new List <GameObject>(); // list of game objects to return back

        if (eTileType == ETileType.plain)
        {
            gameObject = Instantiate(PlainTile, new Vector3(x, y, 0f), transform.rotation);
        }
        if (eTileType == ETileType.danger)
        {
            gameObject = Instantiate(DangerTile, new Vector3(x, y, 0f), transform.rotation);
        }

        if (eTileType == ETileType.jump) // can create a 2+ tile jump obstacle
        {
            jumpHeight = randomNumber.Next(1, 2);
            for (var a = 0; a <= jumpHeight; a++)
            {
                objectList.Add(Instantiate(JumpTile, new Vector3(x, y + a, 0f), transform.rotation)); // first
                if (gameObject)
                {
                    objectList[objectList.Count - 1].transform.parent = gameObject.transform; // set new object to parent of previous object
                }
                gameObject = objectList[objectList.Count - 1];                                // set gameObject to new object
            }
            gameObject = objectList[0];
        }
        return(gameObject);
    }
 public AttachableTile(string id, ActorType actorType, StatusType statusType, Transform3D transform,
                       OurEffectParameters effectParameters, Model model, ETileType tileType) :
     base(id, actorType, statusType, transform, effectParameters, model, true, tileType)
 {
     IsAttached  = false;
     RotatePoint = Vector3.Zero;
 }
Exemple #12
0
 public Tile(int x, int y, BaseGenerator parent)
 {
     this.X         = x;
     this.Y         = y;
     this.ParentMap = parent;
     Type           = ETileType.WALL;
 }
Exemple #13
0
 public Tile(ETileType type, int colplace, int rowplace)
 {
     this.type     = type;
     this.colplace = colplace;
     this.rowplace = rowplace;
     clickButton   = new TileButton(GameStateManager.publicInstance.gameInstance, 0, 0); //Will update these values later
     // Xpos and Ypos are assigned during draw
 }
Exemple #14
0
    /// <summary>Checks if there is item available in players inventory</summary>
    /// <param name="tileType">Tile type for which condition will be checked</param>
    /// <returns>Returns true if such item available in the inventory. Otherwise returns false</returns>
    public bool HasSuchItemInInventory(ETileType tileType)
    {
        if (_playerInventory.GetNumberOfGivenTilesInInventory(tileType) <= 0)
        {
            return(false);
        }

        return(true);
    }
Exemple #15
0
 public FeTileInfo(ETileType _type)
 {
     type     = _type;
     name     = type.ToString();
     avoid    = recover = phyDef = fireDef = iceDef = thunderDef = 0;
     moveCost = new int[(int)EnumMoveClassType.Count] {
         1, 1, 1, 1, 1, 1
     };
 }
    /// <summary>Gets number of given TileType in the inventory</summary>
    /// <param name="tileType">TileType for which selection will be made</param>
    /// <returns>Returns number of given TileType in the inventor</returns>
    public int GetNumberOfGivenTilesInInventory(ETileType tileType)
    {
        if (!_items.ContainsKey(tileType))
        {
            return(0);
        }

        return(_items[tileType].Count);
    }
    /// <summary>Finds tile of a given type, removes it from inventory and returns it</summary>
    /// <param name="itemType">TileType that will be found in inventory</param>
    /// <returns>Returns Tile if it is present in inventory. Otherwise returns null</returns>
    public Tile TakeTileFromInventory(ETileType itemType)
    {
        if (GetNumberOfGivenTilesInInventory(itemType) == 0)
        {
            return(null);
        }

        return(_items[itemType].Pop());
    }
    public List <Tile> GetAllTilesOfAGivenType(ETileType type)
    {
        if (!_items.ContainsKey(type))
        {
            return(null);
        }

        return(_items[type].ToList());
    }
Exemple #19
0
    /// <summary>
    /// elementDict를 현재 존재하는 ETileType에 따라서 List를 저장
    /// </summary>
    private void initializeDict()
    {
        elementDict = new Dictionary <ETileType, List <CContent> >();

        for (ETileType t = ETileType.Flat; t < ETileType.COUNT; t++)
        {
            elementDict.Add(t, new List <CContent>());
        }
    }
Exemple #20
0
        public void Show(ETileType TileID)
        {
            var v = FeTileData.TileInfos[TileID];

            Avoid.text           = v.avoid.ToString();
            PhysicalDefence.text = v.phyDef.ToString();
            MagicalDefence.text  = v.fireDef.ToString();
            Recover.text         = v.recover.ToString();
            TileName.text        = v.name.ToString();
            gameObject.SetActive(true);
        }
Exemple #21
0
    private static FeTileInfo CreateTileInfo(ETileType type, int avoid = 0, int phyDef = 0, int fireDef = 0, int iceDef = 0, int thunderDef = 0)
    {
        FeTileInfo r = new FeTileInfo(type);

        r.avoid      = avoid;
        r.phyDef     = phyDef;
        r.fireDef    = fireDef;
        r.iceDef     = iceDef;
        r.thunderDef = thunderDef;
        return(r);
    }
Exemple #22
0
    public void SetTileType(ETileType eTileType)
    {
        m_eTileType = eTileType;

        if (m_eTileType == ETileType.PELLET || m_eTileType == ETileType.SUPER_PELLET)
        {
            ScoresManager.Instance.RegisterPellet();
        }

        m_pWallObject.SetActive(eTileType == ETileType.WALL);
        InitPellet();
    }
Exemple #23
0
 private void Start()
 {
     if(Random.Range(0, 5) > 0)
     {
         TileType = ETileType.TT_Green;
         GetComponent<Renderer>().material = GreenMat;
     }
     else
     {
         TileType = ETileType.TT_Yellow;
         GetComponent<Renderer>().material = YellowMat;
     }
 }
Exemple #24
0
    public override TileFactory Create()
    {
        //제작 대기큐 탈퇴
        factoryData._workingFactories.Remove(this);
        //생성된 타일 풀에 등록
        factoryData._allTileFactories.Add(tileIndex, this);
        //제작가능한 방향 가져오기
        List <Vector2Int> workableDirection = GetWorkableDirection();

        if (workableDirection.Count == 0)
        {
            factoryData._allTileFactories.Remove(tileIndex);
            RoomFactory room = new RoomFactory(tileIndex, factoryData);
            factoryData._allTileFactories.Add(tileIndex, room);
            return(room);
        }

        //제작할 방향갯수 가져오기
        int workingDirectionCount = DecideProcessDirectionCount(workableDirection.Count);

        ShuffleList(ref workableDirection, 10);

        //해당제작방향들 작업
        for (int i = 0; i < workingDirectionCount; ++i)
        {
            //자신의 타일에 해당 방향으로 통로 추가
            entrances.Add(workableDirection[i]);
            Vector2Int currentIndex = tileIndex + workableDirection[i];
            ETileType  tileType     = DecideTileType();

            if (tileType == ETileType.E_BRIDGE)
            {
                BridgeFactory nextTile = new BridgeFactory(currentIndex, factoryData);
                nextTile.parent = tileIndex;
                //제작 브릿지에 자신의 방향으로 통로추가
                nextTile.entrances.Add(workableDirection[i] * -1);
                factoryData._workingFactories.Add(nextTile);
            }
            else if (tileType == ETileType.E_ROOM)
            {
                RoomFactory nextTile = new RoomFactory(currentIndex, factoryData);
                nextTile.parent = tileIndex;
                factoryData._workingFactories.Add(nextTile);
            }
        }

        return(this);
    }
    public void SetTileTypeAtPos(int aRow, int aCol, ETileType aType)
    {
        if (aRow < m_LevelData.GetWidth() && aRow >= 0 &&
            aCol < m_LevelData.GetHeight() && aCol >= 0)
        {
            float   x          = (-Screen.width + TILE_SIZE) / PIXEL_PER_UNIT / 2.0f;
            float   y          = (Screen.height - TILE_SIZE) / PIXEL_PER_UNIT / 2.0f;
            Vector2 initialPos = new Vector2(x, y);

            Vector2 offset   = new Vector2(TILE_SIZE * aCol / PIXEL_PER_UNIT, -TILE_SIZE * aRow / PIXEL_PER_UNIT);
            Vector2 spawnPos = initialPos + offset;

            m_LevelData.Tiles[aCol][aRow] = aType;
            CreateTile(aType, spawnPos);
        }
    }
Exemple #26
0
    public static TileCoordinates GenLevel(string filename)
    {
        filename = Application.streamingAssetsPath + filename;

        string[] lines = File.ReadAllLines(filename);
        int      x     = 0;
        int      y     = 0;

        foreach (string line in lines)
        {
            string[] lienOfTile = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            x = 0;
            foreach (string tileInfo in lienOfTile)
            {
                string[] words = tileInfo.Split(',');

                ETileType tileType = ms_CharToTileType[words[0]];
                if (tileType == ETileType.None)
                {
                    x++;
                    continue;
                }
                GameObject tileGameObject = GameObject.Instantiate(RessourceManager.LoadPrefab("Tile"));
                tileGameObject.transform.position = new Vector3(x.ToWorldUnit(), y.ToWorldUnit(), 0);
                Tile tile = tileGameObject.AddComponent <Tile> ();
                tile.SetCoordinates(new TileCoordinates(x, y));
                tile.SetType(tileType);

                TileManagerProxy.Get().AddTile(tile);

                if (words.Length > 1)
                {
                    ETileObjectType tileObjectType       = (ETileObjectType)Enum.Parse(typeof(ETileObjectType), (String)words.GetValue(1), true);
                    GameObject      tileObjectGameObject = GameObject.Instantiate(RessourceManager.LoadPrefab("TileObject_" + words[1]));
                    tileObjectGameObject.transform.position = new Vector3(x.ToWorldUnit(), y.ToWorldUnit(), 0);
                    TileObject tileObject = tileObjectGameObject.GetComponent <TileObject> ();
                    tileObject.Init(tileObjectType, x, y, words.SubArray(2, -1));
                    tile.SetTileObject(tileObject);
                }

                x++;
            }
            y--;
        }

        return(new TileCoordinates(x, y));
    }
Exemple #27
0
        public Tile MakeTile(ETileType tileType, EDirection direction = EDirection.NONE)
        {
            switch (tileType)
            {
            case ETileType.ADDTILE: return(AddTileFactory.Instance().MakeTile(direction));

            case ETileType.ITILE: return(ITileFactory.Instance().MakeTile(direction));

            case ETileType.LTILE: return(LTileFactory.Instance().MakeTile(direction));

            case ETileType.SQUARETILE: return(SquareTileFactory.Instance().MakeTile(direction));

            case ETileType.ZTILE: return(ZTileFactory.Instance().MakeTile(direction));

            default: return(null);
            }
        }
Exemple #28
0
 /// <summary>
 /// Checks if a tile can be rezised without interfiering with oter tiles around it
 /// </summary>
 /// <param name="newTile">The new tile type</param>
 /// <returns><c>True</c> if the tile has space to change size, <c>false</c> otherwise</returns>
 public bool CanChangeSizeTo(ETileType newTile)
 {
     //Raycast over a box with the grid converted to position using the new tile type at the center and the tile size as the tile size as the box definition
     RaycastHit[] hits = Physics.BoxCastAll(ConvertGridToPosition(m_gridX, m_gridZ, newTile) + (Vector3.up * 20.0f), GetTileSize(newTile) * 4.5f, Vector3.down, Quaternion.identity, 20.0f, 1 << 30);
     //Go trought all object hitted and check if there is another map tile there
     foreach (RaycastHit hit in hits)
     {
         MapTile mt = hit.transform.gameObject.GetComponent <MapTile>();
         if (mt != null && mt != this)
         {
             //There is another tile so we cannot change
             return(false);
         }
     }
     //No tile so we can change
     return(true);
 }
Exemple #29
0
 /// <summary>
 /// Checks if a tile can be placed on the given position
 /// </summary>
 /// <param name="x">Grid X position</param>
 /// <param name="z">Griz Z pos</param>
 /// <param name="tile">The type of the tile</param>
 /// <returns><c>True</c> if there is space to move a tile there, <c>false</c> otherwise</returns>
 public static bool CanMoveToGridPos(int x, int z, ETileType tile)
 {
     //Raycast over a box with the pos at the center and the tile size as the tile size as the box definition
     RaycastHit[] hits = Physics.BoxCastAll(ConvertGridToPosition(x, z, tile) + (Vector3.up * 20.0f), GetTileSize(tile) * 4.5f, Vector3.down, Quaternion.identity, 20.0f, 1 << 30);
     //Go trought all object hitted and check if there is another map tile there
     foreach (RaycastHit hit in hits)
     {
         MapTile mt = hit.transform.gameObject.GetComponent <MapTile>();
         if (mt != null)
         {
             //There is another tile so we cannot move there
             return(false);
         }
     }
     //No tile found so we can move
     return(true);
 }
Exemple #30
0
 /// <summary>
 /// Get the tile at a certan position
 /// </summary>
 /// <param name="x">X position</param>
 /// <param name="z">Z position</param>
 /// <param name="type">the tile type we found in the position, if there is any</param>
 /// <returns>true if there is a tile type, false if there is none</returns>
 public static bool GetTileAtPos(int x, int z, out ETileType type)
 {
     type = ETileType.Size1x1;
     //Raycast to the position
     RaycastHit[] hits = Physics.BoxCastAll(ConvertGridToPosition(x, z, ETileType.Size1x1) + (Vector3.up * 20.0f), GetTileSize(ETileType.Size1x1) * 4.5f, Vector3.down, Quaternion.identity, 20.0f, 1 << 30);
     //Go trought all object hitted and check if there is another map tile there
     foreach (RaycastHit hit in hits)
     {
         MapTile mt = hit.transform.gameObject.GetComponent <MapTile>();
         if (mt != null)
         {
             //There is another tile return true and the tile type
             type = mt.TileType;
             return(true);
         }
     }
     return(false);
 }
    // 맵 구성 요소들 생성(돌, 꽃, 바구니 등등..)
    void MakeTiles()
    {
        for (int j = 0; j < Const.TileCntY; j++)
        {
            for (int i = 0; i < Const.TileCntX; i++)
            {
                int  idx  = i + j * Const.TileCntX;
                Tile tile = CreateTile(idx);
                mTileMap[idx] = tile;

                ETileType tile_type = ETileType.Default;
                if (mLoadMapData.Count > idx)
                {
                    tile_type = (ETileType)mLoadMapData[idx];
                }
                tile.SetTileType(tile_type);
            }
        }
    }
        public Tile CreateTile(Vector3 position, ETileType type, Tile.StaticTileType staticTileType)
        {
            Tile tile = type switch
            {
                ETileType.Player => CreatePlayer(position),
                ETileType.Static => CreateStatic(position, staticTileType),
                ETileType.Attachable => CreateAttachable(position),
                ETileType.Win => CreateTile("GoalTile", position),
                ETileType.Enemy => CreateEnemy(position),
                ETileType.Button => CreateButton(position),
                ETileType.MovingPlatform => CreateMovingPlatform(position),
                ETileType.Spike => CreateTile("SpikeTile", position),
                ETileType.Star => CreatePickup(position),
                ETileType.Checkpoint => mode?CreateTile("CheckpointTile", position, 2) : null,
                    ETileType.Door => CreateDoorTile(position),
                    _ => null
            };

            return(tile);
        }
 public TileData(ETileType type, Texture2D texture, Color tint)
 {
     this.TileType = type;
     this.Texture = texture;
     this.Tint = tint;
 }
Exemple #34
0
 public Tile(int x, int y, TileData data)
     : base(data.Texture, new Vector2(x + 32, y+ 32), SIZE, new Rectangle(0, 0, 64, 64))
 {
     type = data.TileType;
     color = data.Tint;
 }