Esempio n. 1
0
    public TeleportTargetInfo(string mapName, string roomName, string teleportPortalName, AudioClip soundEffect)
    {
        this.mapName  = mapName;
        this.roomName = roomName;

        if (MMX.GameManager.map.name == mapName)
        {
            this.map = MMX.GameManager.map.GetComponent <MapInfo>();
        }
        else
        {
            this.map = Resources.Load <GameObject>("地图/" + mapName).GetComponent <MapInfo>();
        }
        foreach (var item in map.rooms)
        {
            if (item.name == roomName)
            {
                this.room = item;
                break;
            }
        }
        foreach (var item in room.gameObject.GetComponentsInChildren <EventAction>())
        {
            if (item.type == EventActionType.teleport)
            {
                if (item.name == teleportPortalName)
                {
                    var teleportPortal = TeleportPortal.ConvertEventActionToTeleportPortal(item);
                    this.position = (Vector2)teleportPortal.gameObject.transform.position + teleportPortal.dropZoneOffset;
                }
            }
        }

        this.soundEffect     = soundEffect;
        this.backgroundMusic = this.room.backgroundMusic;
        this.cameraConfiner  = this.room.cameraConfiner;
    }
Esempio n. 2
0
    public void execute(EventAction eventAction)
    {
        TeleportPortal teleport = TeleportPortal.ConvertEventActionToTeleportPortal(eventAction);

        this.teleport(teleport);
    }