public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Controller = reader.ReadItem() as MasterThinkerContoller;
            m_Type       = (DecorType)reader.ReadInt();
        }
 protected ImmobileObject(DecorType type, int priority, int noiseSuppression, bool isSolid, bool isOpaque)
 {
     Type             = type;
     Priority         = priority;
     NoiseSuppression = noiseSuppression;
     IsSolid          = isSolid;
     IsOpaque         = isOpaque;
 }
Beispiel #3
0
 public TileStruct(int x, int y, TileType type, TerrainType terrainType, DecorType decor)
 {
     this.DecorType = decor;
     SetBoth(terrainType);
     this.X = x;
     this.Y = y;
     this.Type = type;
 }
 public MasterThinkerDecor(int id, int hue, DecorType type, MasterThinkerContoller controller)
     : base()
 {
     ItemID       = id;
     m_Controller = controller;
     m_Type       = type;
     Hue          = hue;
     Movable      = false;
 }
Beispiel #5
0
    /// <summary>
    /// int로 적합한 리스트 반환
    /// </summary>
    /// <param name="dt">장식물 타입</param>
    /// <returns></returns>
    public List <GameObject> GetDecorList(int num)
    {
        if (num < 0 || num >= DecorType.GetTypeCount())
        {
            return(null);
        }

        return(GetDecorList((DecorType.Type)num));
    }
Beispiel #6
0
    /// <summary>
    /// 데코 생성
    /// </summary>
    /// <param name="decorTypeNum">원본 오브젝트 타입(golPrefabNum)</param>
    /// <param name="prefabIndex">원본 오브젝트 인덱스(golPrefabNum)</param>
    /// <param name="pos">결과물 오브젝트 position</param>
    /// <param name="rot">결과물 오브젝트 rotation</param>
    /// <param name="scl">결과물 오브젝트 scale</param>
    /// <returns></returns>
    public Transform Create(int decorTypeNum, int prefabIndex, Vector3 pos, Vector3 rot, Vector3 scl)
    {
        // 잘못된 타입 중단
        if (decorTypeNum == (int)DecorType.Type.None || decorTypeNum >= DecorType.GetTypeCount())
        {
            return(null);
        }

        // 형변환
        DecorType.Type dt = (DecorType.Type)decorTypeNum;

        // 복사 대상이 없을 경우
        if (prefabIndex < 0 || prefabIndex >= GetDecorList(dt).Count)
        {
            return(null);
        }


        // 생성
        Transform copyObject = Instantiate(
            GetDecorList(dt)[prefabIndex],      // 복사할 GameObject
            pos,                                // position
            Quaternion.Euler(rot),              // rotation
            decorMaster                         // 부모 지정
            ).transform;

        // 스케일 지정
        copyObject.localScale = scl;

        //목록 추가
        gol.Add(copyObject.gameObject);
        golTypeNum.Add(decorTypeNum);
        golPrefabNum.Add(prefabIndex);

        // 부모 지정
        copyObject.SetParent(decorMaster);

        // 오브젝트 이름 변경
        copyObject.name = string.Format("{0} ({1})", GetDecorList(dt)[prefabIndex].name.Split(' ')[0], gol.Count - 1);

        // 로그 출력
        Debug.Log(string.Format("create decor :: {0}\n type={1} typeIndex={2} position=({3}, {4}, {5}) rotation=({6}, {7}, {8}) scale=({9}, {10}, {11})", copyObject.name, decorTypeNum, prefabIndex, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scl.x, scl.y, scl.z));

        return(copyObject);
    }
Beispiel #7
0
        /// <summary>
        /// 대분류 드롭다운 새로고침
        /// </summary>
        void SetDropdown()
        {
            // 초기화
            category1.options.Clear();

            // 목록 추가
            for (int i = 1; i < DecorType.GetTypeCount(); i++)
            {
                category1.options.Add(
                    new Dropdown.OptionData(
                        ((DecorType.Type)i).ToString(),
                        null)
                    );
            }

            // 기본값 지정
            category1.value = 0;

            // 새로고침
            category1.RefreshShownValue();

            SetDropdown((DecorType.Type)(category1.value + 1));
        }
Beispiel #8
0
 public Decor GetRegisteredDecor(string propertyName, DecorType type)
 {
     return(_decors.FirstOrDefault(p => p.Type == type && p.PropertyName == propertyName));
 }
Beispiel #9
0
 /// <summary>
 /// Registers a decor if one does not exist already.
 /// </summary>
 /// <param name="propertyName">The property name to register</param>
 /// <param name="type">The type to register</param>
 public void RegisterDecor(string propertyName, DecorType type)
 {
     RegisterDecor(new Decor(propertyName, type));
 }
Beispiel #10
0
 public Decor(string propertyName, DecorType type)
 {
     PropertyName = propertyName;
     Type         = type;
 }
Beispiel #11
0
 protected Item(int price, DecorType type, int priority, int noiseSuppression, bool isSolid, bool isOpaque)
     : base(type, priority, noiseSuppression, isSolid, isOpaque)
 {
     Price = price;
     Type  = type;
 }
Beispiel #12
0
 protected Item(int price, DecorType type) : this(price, type, 30, 0, false, false)
 {
 }
Beispiel #13
0
 public static Decor CreateDecor(Vector2 position, DecorType type, Room room)
 {
     Decor decor = Room.CreateObject (RoomObjectType.Decor, position, null, room) as Decor;
     decor.decorType = type;
     return decor;
 }
Beispiel #14
0
    public void Sprinkle(TileStruct[][] map, int percentage, DecorType decor)
    {
        MapGen handler = new MapGen(MapWidth, MapHeight, percentage, TerrainType, seed);
        handler.BlankMap();
        handler.RandomFillMap();

        handler.MakeCaverns();

        var overlayingMap = handler.GetAsTileStructArr();

        for (int y = 0; y < overlayingMap.Length; y++)
        {
            for (int x = 0; x < overlayingMap[0].Length; x++)
            {
                if (overlayingMap[y][x].Type == TileType.Dirt)
                {
                    map[y][x].DecorType = decor;
                }
            }
        }
    }