Пример #1
0
        public override int Traverse()
        {
            var ent = SectorManager.instance.GetEntity(entityID);

            TaskManager.ObjectiveLocation objectiveLocation;
            if (ent)
            {
                objectiveLocation = new TaskManager.ObjectiveLocation(
                    ent.transform.position,
                    true,
                    (Canvas as QuestCanvas).missionName,
                    SectorManager.instance.current.dimension,
                    ent
                    );
            }
            else
            {
                var sect   = SectorManager.GetSectorByName(sectorName);
                var bounds = sect.bounds;
                objectiveLocation = new TaskManager.ObjectiveLocation(
                    new Vector2(bounds.x + bounds.w / 2, bounds.y - bounds.h / 2),
                    true,
                    (Canvas as QuestCanvas).missionName,
                    sect.dimension
                    );
            }

            TaskManager.objectiveLocations[(Canvas as QuestCanvas).missionName].Add(objectiveLocation);
            TaskManager.DrawObjectiveLocations();
            return(0);
        }
Пример #2
0
    public void Interact()
    {
        switch (interactibility)
        {
        case FlagInteractibility.Warp:

            // need player to warp
            if (!PlayerCore.Instance)
            {
                break;
            }
            // use sectorName and entityID to find the transform to warp to
            var sector = SectorManager.GetSectorByName(sectorName);
            foreach (var ent in sector.entities)
            {
                if (ent.ID == entityID)
                {
                    ;
                    // position is a global vector (i.e., not local to the sector itself), so this should work
                    PlayerCore.Instance.Warp(ent.position);
                }
            }
            break;
        }
    }
Пример #3
0
        void TryAddObjective()
        {
            var bounds = SectorManager.GetSectorByName(sectorName).bounds;

            TaskManager.objectiveLocations[(Canvas as QuestCanvas).missionName].Clear();
            TaskManager.objectiveLocations[(Canvas as QuestCanvas).missionName].Add(new TaskManager.ObjectiveLocation
                                                                                    (
                                                                                        new Vector2(bounds.x + bounds.w / 2, bounds.y - bounds.h / 2),
                                                                                        true,
                                                                                        (Canvas as QuestCanvas).missionName
                                                                                    ));
            TaskManager.DrawObjectiveLocations();
        }
Пример #4
0
    public static void FindEntityAndWarpPlayer(string sectorName, string entityID)
    {
        // need player to warp
        if (!PlayerCore.Instance)
        {
            return;
        }

        // use sectorName and entityID to find the transform to warp to
        var sector = SectorManager.GetSectorByName(sectorName);

        if (sector == null)
        {
            Debug.LogWarning("<Flag> Cannot find specified sector");
            return;
        }
        else
        {
            var dimensionChanged = PlayerCore.Instance.Dimension != sector.dimension;
            PlayerCore.Instance.Dimension = sector.dimension;

            // TODO: We currently nuke all characters when teleporting to a different dimension. It would be nicer to have
            // a set dimension for each character which is appropriately used.
            if (dimensionChanged)
            {
                foreach (var ent in AIData.entities)
                {
                    if (!(PartyManager.instance && PartyManager.instance.partyMembers != null && ent is ShellCore shellCore &&
                          PartyManager.instance.partyMembers.Contains(shellCore)))
                    {
                        foreach (var data in SectorManager.instance.characters)
                        {
                            if (data.ID == ent.ID)
                            {
                                Destroy(ent.gameObject);
                            }
                        }
                    }
                }
            }
        }

        foreach (var ent in sector.entities)
        {
            if (ent.ID == entityID)
            {
                // position is a global vector (i.e., not local to the sector itself), so this should work
                PlayerCore.Instance.Warp(ent.position);
            }
        }
    }
Пример #5
0
    public void LoadMap()
    {
        var sector = SectorManager.GetSectorByName(currentOption.sectorName);

        if (sector == null)
        {
            return;
        }

        List <Sector> sectors = new List <Sector>()
        {
            sector
        };

        GetComponentInChildren <MapMakerScript>().redraw(sectors, 1, sector.dimension, true);
    }
Пример #6
0
        void TryAddObjective()
        {
            if (!TaskManager.objectiveLocations.ContainsKey((Canvas as QuestCanvas).missionName))
            {
                Debug.LogError($"Task Manager does not contain an objective list for mission {(Canvas as QuestCanvas).missionName}");
                return;
            }
            var sect   = SectorManager.GetSectorByName(sectorName);
            var bounds = sect.bounds;

            TaskManager.objectiveLocations[(Canvas as QuestCanvas).missionName].Clear();
            TaskManager.objectiveLocations[(Canvas as QuestCanvas).missionName].Add(new TaskManager.ObjectiveLocation
                                                                                    (
                                                                                        new Vector2(bounds.x + bounds.w / 2, bounds.y - bounds.h / 2),
                                                                                        true,
                                                                                        (Canvas as QuestCanvas).missionName,
                                                                                        sect.dimension
                                                                                    ));
            TaskManager.DrawObjectiveLocations();
        }