コード例 #1
0
    // -----------------------------------------------------------------------------------
    // teleportPlayerToInstance
    // -----------------------------------------------------------------------------------
    public void teleportPlayerToInstance(Player player)
    {
        if (!canPlayerEnter(player))
        {
            return;
        }

        payEntranceCost(player);

        int index = targetArea.getGroupIndex(player);

        if (index == -1)
        {
            index = 0;
        }

        UCE_PlayerGroupLocations locations = targetArea.playerGroupLocation[index];

        if (locations.teleportPosition.Length == 0)
        {
            return;
        }

        index = UnityEngine.Random.Range(0, locations.teleportPosition.Length - 1);

        player.Cmd_UCE_Warp(locations.teleportPosition[index].position);
    }
コード例 #2
0
    public void Cmd_UCE_teleportPlayerToInstance(int index, int instanceCategory, int instanceIndex)
    {
        if (!sharedInstanceManager)
        {
            sharedInstanceManager = FindObjectOfType <UCE_LimitedZonesManager>();
        }

        List <UCE_LimitedZonesEntry> instancesAvailable = sharedInstanceManager.getAvailableSharedInstances(this, instanceCategory);

        instancesAvailable[instanceIndex].payEntranceCost(this);

        UCE_PlayerGroupLocations locations = instancesAvailable[instanceIndex].targetArea.playerGroupLocation[index];

        if (locations.teleportPosition.Length == 0)
        {
            return;
        }

        index = UnityEngine.Random.Range(0, locations.teleportPosition.Length - 1);

        agent.Warp(locations.teleportPosition[index].position);
    }