Beispiel #1
0
        // Token: 0x060010BE RID: 4286
        private void UpdateRelicViewHUDState(CollectibleEntityView view)
        {
            // MOD: remove artifact views that are moved off the map
            if (view.Entity.GetComponent(10).Position2D.X > Fixed64.FromInt(100000))
            {
                this.DespawnAndRemoveRelicView(view.Entity, view);
                return;
            }
            // MOD

            SimStateFrame currentSimFrame = ShipbreakersMain.CurrentSimFrame;

            if (currentSimFrame == null)
            {
                return;
            }
            RelicState relicState = currentSimFrame.FindObject <RelicState>(view.Entity);

            if (relicState == null)
            {
                return;
            }
            CollectibleState collectibleState = currentSimFrame.FindObject <CollectibleState>(view.Entity);

            if (collectibleState == null)
            {
                return;
            }
            DetectionState visibility = relicState.Visibility;

            if (ReplayPanelController.RevealAll || SimController.sSpectatorModeEnabled)
            {
                visibility = DetectionState.Sensed;
            }
            bool flag = relicState.HasTimer && relicState.TimerDirection == TimerDirection.Countup && !relicState.TimerCompleted;

            if (collectibleState.AvailableForCollection)
            {
                this.UpdateRelicDefaultIconSprite(view, visibility, flag);
            }
            else
            {
                this.UpdateRelicAttachedIconSprite(view, DetectionState.Sensed, false);
            }
            this.UpdateRelicIconTrackOnScreenEdge(view, !flag);
            bool flag2 = view.ShouldShowIcon();

            view.ShowIcon(flag2);
            if (!flag2 && this.mShowingTooltipForEntity != Entity.None && this.mShowingTooltipForEntity == view.Entity)
            {
                this.mShowingTooltipForEntity = Entity.None;
                UISystem.HideTooltip();
            }
        }
 public static F64Vec3 FromInt(int x, int y, int z)
 {
     return(new F64Vec3(Fixed64.FromInt(x), Fixed64.FromInt(y), Fixed64.FromInt(z)));
 }
Beispiel #3
0
 // Constructors
 public F64(int v)
 {
     Raw = Fixed64.FromInt(v);
 }
Beispiel #4
0
 public static bool operator >=(F64 v1, int v2)
 {
     return(v1.Raw >= Fixed64.FromInt(v2));
 }
Beispiel #5
0
 public static bool operator >=(int v1, F64 v2)
 {
     return(Fixed64.FromInt(v1) >= v2.Raw);
 }
Beispiel #6
0
 public static F64 operator %(int v1, F64 v2)
 {
     return(FromRaw(Fixed64.Mod(Fixed64.FromInt(v1), v2.Raw)));
 }
Beispiel #7
0
 public static F64 operator %(F64 v1, int v2)
 {
     return(FromRaw(Fixed64.Mod(v1.Raw, Fixed64.FromInt(v2))));
 }
Beispiel #8
0
 public static F64 operator /(int v1, F64 v2)
 {
     return(FromRaw(Fixed64.DivPrecise(Fixed64.FromInt(v1), v2.Raw)));
 }
Beispiel #9
0
 public static F64 operator -(int v1, F64 v2)
 {
     return(FromRaw(Fixed64.FromInt(v1) - v2.Raw));
 }
Beispiel #10
0
 public static F64 operator -(F64 v1, int v2)
 {
     return(FromRaw(v1.Raw - Fixed64.FromInt(v2)));
 }
Beispiel #11
0
 public static F64Vec2 FromInt(int x, int y)
 {
     return(new F64Vec2(Fixed64.FromInt(x), Fixed64.FromInt(y)));
 }
Beispiel #12
0
    // Loads a map layout onto a map
    // Map layouts include spawn, artifact, resource and extraction zone locations
    // This function also removes certain aspects of the level that are already there e.g. wrecks
    public static void LoadMapLayout()
    {
        // No map loaded anymore
        MapXml     = "";
        LayoutName = "";

        Subsystem.AttributeLoader.PatchOverrideData = "";
        PatchName = "";

        if (CustomLayout)
        {
            // Move DoK engine objects
            foreach (Entity entity in Sim.Instance.EntitySystem)
            {
                if (entity.HasComponent(11))
                {
                    entity.GetComponent <Position>(10).Position2D = new Vector2r(Fixed64.FromInt(1000000), Fixed64.FromInt(1000000)); // Move off the map
                    entity.GetComponent <Resource>(11).Disabled   = true;                                                             // Make unminable, keeping these in just in case the AI tries to mine from these resources
                }
                else if (entity.HasComponent(36) || entity.HasComponent(14))
                {
                    entity.GetComponent <Position>(10).Position2D = new Vector2r(Fixed64.FromInt(1000000), Fixed64.FromInt(1000000));                    // Move off the map
                }
            }

            // Disable the pesky black box at the start of levels
            // Its there to be a transition from what I can tell
            GameObject blackBox = GameObject.Find("BlackPolygon");
            if (blackBox != null)
            {
                blackBox.transform.position = new Vector3(1000000.0f, 1000000.0f, 1000000.0f);
            }

            // Loading resource layout
            foreach (MapResourceData resource in resources)
            {
                DetectableAttributesData detectableAttributesData = new DetectableAttributesData()
                {
                    m_SetHasBeenSeenBeforeOnSpawn = true,
                };
                SceneEntityCreator.CreateResourcePoint((resource.type == 0) ? "Resource_CU" : "Resource_RU", resource.position, default(Orientation2), new string[0], new ResourceAttributesData((ResourceType)resource.type, resource.amount, resource.collectors), detectableAttributesData, false, default(ResourcePositionalVariations), false);
            }

            // Delete starting units of commanders with no starting fleet
            foreach (MapSpawnData spawn in spawns)
            {
                if (spawn.fleet)
                {
                    continue;
                }
                foreach (Commander commander in Sim.Instance.CommanderManager.Commanders)
                {
                    CommanderDirectorAttributes director = Sim.Instance.CommanderManager.GetCommanderDirectorFromID(commander.ID);
                    if (director.PlayerType == PlayerType.AI)
                    {
                        continue;                                                           // AI needs starting carrier
                    }
                    if (((GameMode == TeamSetting.Team) ? (1 - spawn.team) * 3 : spawn.team) + spawn.index == director.SpawnIndex)
                    {
                        foreach (Entity entity in Sim.Instance.EntitySystem.Query().Has(2))                           // All units
                        {
                            if (entity.GetComponent <OwningCommander>(5).ID == commander.ID)                          // Check if the faction is correct
                            {
                                entity.GetComponent <Unit>(2).RetireDespawn();
                            }
                        }
                    }
                }
            }

            // Loading units
            foreach (MapUnitData unit in units)
            {
                // Convert team + index to commander ID then spawn unit
                foreach (Commander commander in Sim.Instance.CommanderManager.Commanders)
                {
                    CommanderDirectorAttributes director = Sim.Instance.CommanderManager.GetCommanderDirectorFromID(commander.ID);
                    if (((GameMode == TeamSetting.Team) ? (1 - unit.team) * 3 : unit.team) + unit.index == director.SpawnIndex)
                    {
                        if (commander.CommanderAttributes.Name == "SPECTATOR")
                        {
                            continue;                             // Don't spawn units for spectators
                        }
                        else if (sobanUnits.Contains(unit.type) && commander.CommanderAttributes.Faction.ID != FactionID.Soban)
                        {
                            continue;                             // Don't spawn Soban units for non Soban players
                        }
                        else if (khaanUnits.Contains(unit.type) && commander.CommanderAttributes.Faction.ID != FactionID.Khaaneph)
                        {
                            continue;                             // Don't spawn Khaaneph units for non Khaaneph players
                        }
                        SceneEntityCreator.CreateEntity(unit.type, commander.ID, unit.position, unit.orientation);
                        break;
                    }
                }
            }

            // Loading wrecks
            foreach (MapWreckData wreck in wrecks)
            {
                DetectableAttributesData detectableAttributes = new DetectableAttributesData {
                    m_SetHasBeenSeenBeforeOnSpawn = true,
                };

                ResourcePositionalVariations positions = new ResourcePositionalVariations {
                    ModelOrientationEulersDegrees = new Vector3r(Fixed64.FromConstFloat(0.0f), Fixed64.FromConstFloat(wreck.angle), Fixed64.FromConstFloat(0.0f)),
                };

                ShapeAttributesData shape = new ShapeAttributesData {
                    m_Radius           = 100.0f,
                    m_BlocksLOF        = wreck.blockLof,
                    m_BlocksAllHeights = wreck.blockLof,
                };

                ResourceAttributesData res = new ResourceAttributesData {
                    m_ResourceType = ResourceType.Resource3,                     // Type = Wreck
                };

                SimWreckSectionResourceSpawnableAttributesData[] childResources = new SimWreckSectionResourceSpawnableAttributesData[wreck.resources.Count];
                for (int i = 0; i < wreck.resources.Count; i++)
                {
                    childResources[i] = new SimWreckSectionResourceSpawnableAttributesData {
                        m_DetectableAttributes         = new DetectableAttributesData(),
                        m_OverrideDetectableAttributes = true,
                        m_Tags = new string[0],
                        m_EntityTypeToSpawn                     = (wreck.resources[i].type == 1) ? "Resource_RU" : "Resource_CU",
                        m_ResourceAttributes                    = new ResourceAttributesData((ResourceType)wreck.resources[i].type, wreck.resources[i].amount, wreck.resources[i].collectors),
                        m_OverrideResourceAttributes            = true,
                        m_SpawnPositionOffsetFromSectionCenterX = Fixed64.IntValue((wreck.resources[i].position - wreck.position).X),
                        m_SpawnPositionOffsetFromSectionCenterY = Fixed64.IntValue((wreck.resources[i].position - wreck.position).Y),
                        m_UseNonRandomSpawnPositionOffset       = true,
                    };
                }

                SimWreckAttributesData wreckData = new SimWreckAttributesData {
                    m_WreckSections = new SimWreckSectionAttributesData[] {
                        new SimWreckSectionAttributesData {
                            m_ExplosionChance    = 100,
                            m_Health             = 1,
                            m_ResourceSpawnables = childResources,
                        },
                    },
                };

                // Orientation2.LocalForward -> (1.0, 0.0)
                SceneEntityCreator.CreateWreck("Resource_Wreck_MP", wreck.position, Orientation2.LocalForward, new string[0], wreckData, "", shape, res, detectableAttributes, false, positions, false);
            }
        }
    }
Beispiel #13
0
 [MethodImpl(FixedUtil.AggressiveInlining)] public static F64 FromInt(int v)
 {
     return(FromRaw(Fixed64.FromInt(v)));
 }