public static void SetRockContext(GameObject rock, GameObject target, float elevation)
        {
            bool isSpecialLocation = target.transform.parent != null &&
                                     !(target.transform.parent.position.x == 0f && target.transform.parent.position.y == 0f);

            if (target.transform.parent != null && !isSpecialLocation)
            {
                rock.transform.SetParent(target.transform.parent);
            }

            rock.transform.position = target.transform.position;
            if (!isSpecialLocation)
            {
                rock.transform.localPosition = target.transform.localPosition;
            }

            GeoRockSubtype rockType = rock.GetComponent <GeoRockInfo>()?.type ?? GeoRockSubtype.Default;

            rock.transform.position += Vector3.up * (GetElevation(rockType) - elevation);
            if (rockType == GeoRockSubtype.Outskirts420)
            {
                var t = rock.transform;
                t.localScale = new Vector3(t.localScale.x * 0.5f, t.localScale.y * 0.5f, t.localScale.z);
            }
            rock.SetActive(target.activeSelf);
        }
 public static float GetElevation(GeoRockSubtype type)
 {
     if (Elevation.TryGetValue(type, out float value))
     {
         return(value);
     }
     return(-0.8f);
 }
 public CreateNewGeoRock(string sceneName, float x, float y, string rockName, string item, string location, int geo, GeoRockSubtype subtype)
 {
     _sceneName = sceneName;
     _x         = x;
     _y         = y;
     _rockName  = rockName;
     _item      = item;
     _location  = location;
     _geo       = geo;
     _subtype   = subtype;
 }
Пример #4
0
 public ReplaceObjectWithGeoRock(string sceneName, string objectName, float elevation, string rockName, string item, string location, int geo, GeoRockSubtype subtype)
 {
     _sceneName  = sceneName;
     _objectName = objectName;
     _rockName   = rockName;
     _item       = item;
     _location   = location;
     _elevation  = elevation;
     _geo        = geo;
     _subtype    = subtype;
 }
        public static void SetRockContext(GameObject rock, float x, float y, float elevation)
        {
            GeoRockSubtype rockType = rock.GetComponent <GeoRockInfo>()?.type ?? GeoRockSubtype.Default;

            rock.transform.position = new Vector3(x, y + GetElevation(rockType) - elevation);

            if (rockType == GeoRockSubtype.Outskirts420)
            {
                var t = rock.transform;
                t.localScale = new Vector3(t.localScale.x * 0.5f, t.localScale.y * 0.5f, t.localScale.z);
            }
            rock.SetActive(true);
        }
Пример #6
0
 public static GameObject GeoRock(GeoRockSubtype t)
 {
     return(Object.Instantiate(_geoRocks[t]));
 }
Пример #7
0
 public static GeoRockSubtype GetPreloadedRockType(GeoRockSubtype t)
 {
     return(_geoRocks.ContainsKey(t) ? t : GeoRockSubtype.Default);
 }
        public static GameObject MakeNewGeoRock(AbstractPlacement location, IEnumerable <AbstractItem> items, out GeoRockSubtype type)
        {
            type = items.OfType <GeoRockItem>().FirstOrDefault()?.geoRockSubtype ?? GeoRockSubtype.Default;
            GameObject rock = ObjectCache.GeoRock(type);

            rock.AddComponent <GeoRockInfo>().type = type;
            rock.name = GetGeoRockName(location);
            return(rock);
        }