Example #1
0
    public static void DrawTagZone(VmodMonkeMapLoader.Behaviours.TagZone zone, bool single = false)
    {
        Handles.color = Color.red;

        if (Handles.Button(zone.transform.position, zone.transform.rotation, 1.0f, 1.0f, Handles.CubeHandleCap))
        {
            MapDescriptorEditor.moveTo(zone.transform);
        }
        HandleHelpers.Label(zone.transform.position + Vector3.up, new GUIContent(zone.gameObject.name));
    }
Example #2
0
        private IEnumerator TeleportPlayer()
        {
            if (TeleporterType == TeleporterType.Map)
            {
                TeleportPoints = GameObject.Find("SpawnPointContainer")?.GetComponentsInChildren <Transform>().Where(e => e != null && e.gameObject.name != "SpawnPointContainer").ToList();
            }

            if (TeleportPoints == null || !TeleportPoints.HasAtLeast(0))
            {
                if (TeleporterType == TeleporterType.Map)
                {
                    TeleportPoints = new List <Transform>()
                    {
                        GameObject.Find("TreeHomeTargetObject").transform
                    }
                }
                ;
                else
                {
                    yield break;
                }
            }

            var destination = TeleportPoints.Count > 1
                ? TeleportPoints[Random.Range(0, TeleportPoints.Count)]
                : TeleportPoints[0];

            if (TagOnTeleport)
            {
                TagZone.TagLocalPlayer();
            }
            if (JoinGameOnTeleport)
            {
                MapLoader.JoinGame();
            }
            if (TeleporterType == TeleporterType.Treehouse)
            {
                MapLoader.ResetMapProperties();
            }

            PlayerTeleportPatch.TeleportPlayer(destination);

            _isTeleporting = false;
        }
Example #3
0
        private IEnumerator TeleportPlayer()
        {
            if (_isTeleporting || TeleportPoints == null || !TeleportPoints.HasAtLeast(0))
            {
                if (TeleporterType == TeleporterType.Map)
                {
                    TeleportPoints = GameObject.Find("SpawnPointContainer")?.GetComponentsInChildren <Transform>().Where(e => e != null && e.gameObject.name != "SpawnPointContainer").ToList();
                }
            }

            if (TeleportPoints == null || !TeleportPoints.HasAtLeast(0))
            {
                if (TeleporterType == TeleporterType.Map)
                {
                    TeleportPoints = new List <Transform>()
                    {
                        GameObject.Find("TreeHomeTargetObject").transform
                    }
                }
                ;
                else
                {
                    yield break;
                }
            }

            var destination = TeleportPoints.Count > 1
                ? TeleportPoints[Random.Range(0, TeleportPoints.Count)]
                : TeleportPoints[0];

            if (TagOnTeleport)
            {
                TagZone.TagLocalPlayer();
            }
            if (JoinGameOnTeleport)
            {
                MapLoader.JoinGame();
            }
            if (TeleporterType == TeleporterType.Treehouse)
            {
                MapLoader.ResetMapProperties();
            }

            PlayerTeleportPatch.TeleportPlayer(destination);

            _isTeleporting = false;

            if (JoinGameOnTeleport && Events.OnMapEnter != null && destination != MapLoader._globalData.BigTreePoint.transform)
            {
                try
                {
                    Events.OnMapEnter(true);
                }
                catch (Exception e)
                {
                    Debug.LogError(e);
                }
            }
            else if (TeleporterType == TeleporterType.Treehouse && Events.OnMapEnter != null)
            {
                try
                {
                    Events.OnMapEnter(false);
                }
                catch (Exception e)
                {
                    Debug.LogError(e);
                }
            }
        }
Example #4
0
 public void OnSceneGUI()
 {
     VmodMonkeMapLoader.Behaviours.TagZone zone = (VmodMonkeMapLoader.Behaviours.TagZone)target;
     DrawTagZone(zone, true);
 }