Exemplo n.º 1
0
        internal static bool TryCreate(
            AssetLoadContext loadContext,
            StandingWaveArea area,
            out WaterArea result)
        {
            if (area.Points.Length < 3)
            {
                // Some maps (such as Training01) have water areas with fewer than 3 points.
                result = null;
                return(false);
            }

            result = new WaterArea(loadContext, area);
            return(true);
        }
Exemplo n.º 2
0
        public static bool TryCreate(
            ContentManager contentManager,
            PolygonTrigger trigger,
            out WaterArea result)
        {
            if (trigger.Points.Length < 3)
            {
                // Some maps (such as Training01) have water areas with fewer than 3 points.
                result = null;
                return(false);
            }

            result = new WaterArea(contentManager, trigger);
            return(true);
        }
Exemplo n.º 3
0
        internal static bool TryCreate(
            AssetLoadContext loadContext,
            PolygonTrigger trigger,
            out WaterArea result)
        {
            if (trigger.Points.Length < 3)
            {
                // Some maps (such as Training01) have water areas with fewer than 3 points.
                result = null;
                return(false);
            }

            result = new WaterArea(loadContext, trigger);
            return(true);
        }
Exemplo n.º 4
0
        internal WaterAreaCollection(PolygonTriggers polygonTriggers, StandingWaterAreas standingWaterAreas,
                                     StandingWaveAreas standingWaveAreas, AssetLoadContext loadContext)
            : this()
        {
            if (polygonTriggers != null)
            {
                foreach (var polygonTrigger in polygonTriggers.Triggers)
                {
                    switch (polygonTrigger.TriggerType)
                    {
                    case PolygonTriggerType.Water:
                    case PolygonTriggerType.River:     // TODO: Handle this differently. Water texture should be animated "downstream".
                    case PolygonTriggerType.WaterAndRiver:
                        if (WaterArea.TryCreate(loadContext, polygonTrigger, out var waterArea))
                        {
                            _waterAreas.Add(AddDisposable(waterArea));
                        }
                        break;
                    }
                }
            }

            if (standingWaterAreas != null)
            {
                foreach (var standingWaterArea in standingWaterAreas.Areas)
                {
                    if (WaterArea.TryCreate(loadContext, standingWaterArea, out var waterArea))
                    {
                        _waterAreas.Add(AddDisposable(waterArea));
                    }
                }
            }

            if (standingWaveAreas != null)
            {
                foreach (var standingWaveArea in standingWaveAreas.Areas)
                {
                    if (WaterArea.TryCreate(loadContext, standingWaveArea, out var waterArea))
                    {
                        _waterAreas.Add(AddDisposable(waterArea));
                    }
                }
            }
        }