Пример #1
0
        /// <summary> Try to load the Graphic of appropriate type based on current life stage </summary>
        Graphic LoadGraphic(string variant)
        {
            string path = ageTracker.CurKindLifeStage.bodyGraphicData.texPath + "_" + variant;

            if (Prefs.DevMode)
            {
                Log.Message($"path: {path}");
            }
            // determine graphic class type
            System.Type type = null;
            if (contentHolder.Get(path + "_south") != null)
            {
                type = typeof(Graphic_Multi);
            }
            else if (contentHolder.Get(path) != null)
            {
                type = typeof(Graphic_Single);
            }

            if (type == null)
            {
                return(null);                // texture not found, skip graphic
            }
            var data = new GraphicData();

            data.CopyFrom(ageTracker.CurKindLifeStage.bodyGraphicData);
            data.texPath      = path;
            data.graphicClass = type;
            return(data.Graphic);
        }
Пример #2
0
        /// <summary> Set the movementGraphic based on the current life stage </summary>
        private Graphic LoadGraphic(string variant)
        {
            string path = ageTracker.CurKindLifeStage.bodyGraphicData.texPath + "_" + variant;

            // try getting the texture to see if it exists
            var texture = contentHolder.Get(path + "_south");

            if (texture == null)
            {
                return(null);
            }

            var data = new GraphicData();

            data.CopyFrom(ageTracker.CurKindLifeStage.bodyGraphicData);
            data.texPath = path;

            if (data.shadowData != null && variant == "moving")              // meerkat-specific shadow fix
            {
                var shadow = new ShadowData();
                shadow.volume   = data.shadowData.volume + new Vector3(0.15f, -0.15f, -0.1f);
                shadow.offset   = data.shadowData.offset + new Vector3(0.04f, 0, 0.18f);
                data.shadowData = shadow;
            }

            return(data.Graphic);
        }