Exemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // CreateDungeonCeiling
        // -------------------------------------------------------------------------------
        private void CreateDungeonCeiling(int x, int y, GameObject prefab, DungeonTileFloor tile = null)
        {
            if (prefab == null)
            {
                return;
            }

            GameObject go = GameObject.Instantiate(prefab) as GameObject;

            go.name = string.Format("{0}_{1}", x, y);
            go.transform.position = new Vector3(x, Constants.BASEHEIGHT_CEILING, y);
            go.transform.parent   = MapContainer;

            if (tile != null)
            {
                if (tile.facingDirection != DirectionType.None)
                {
                    go.transform.forward = Vector3Helper.CardinalDirection(tile.facingDirection);
                }
            }
        }
Exemplo n.º 2
0
        // ===============================================================================
        // DUNGEON OBJECT CREATION
        // ===============================================================================

        // -------------------------------------------------------------------------------
        // CreateDungeonFloor
        // -------------------------------------------------------------------------------
        private void CreateDungeonFloor(int x, int y, bool canStartFight, GameObject prefab, DungeonTileFloor tile = null)
        {
            if (prefab == null)
            {
                return;
            }

            GameObject go = GameObject.Instantiate(prefab) as GameObject;

            go.name = string.Format("{0}_{1}", x, y);
            go.transform.position = new Vector3(x, Constants.BASEHEIGHT_FLOOR, y);
            go.transform.parent   = MapContainer;

            if (tile != null)
            {
                if (tile.facingDirection != DirectionType.None)
                {
                    go.transform.forward = Vector3Helper.CardinalDirection(tile.facingDirection);
                }
            }

            if (tile != null && canStartFight)
            {
                if (tile.facingDirection != DirectionType.None)
                {
                    go.transform.forward = Vector3Helper.CardinalDirection(tile.facingDirection);
                }
                go.AddComponent <OpenFloorCollisionHandler>();
                OpenFloorCollisionHandler co = go.GetComponent <OpenFloorCollisionHandler>();
                co.encounterRateModifier = tile.encounterRateModifier;
                co.monsterPoolID         = tile.monsterPoolID;
                co.monsterAmountMin      = tile.monsterAmountMin;
                co.monsterAmountMax      = tile.monsterAmountMax;
                co.monsterAmountScale    = tile.monsterAmountScale;
            }
        }