示例#1
0
    private void CmdWarpPlayer()
    {
        Warp.Location playerLocation = Warp.GetLocation(transform);
        Warp.Location warpLocation;

        if (playerLocation == Warp.Location.Blue)
        {
            warpLocation = Warp.Location.Red;
        }
        else if (playerLocation == Warp.Location.Red)
        {
            warpLocation = Warp.Location.Blue;
        }
        else
        {
            warpLocation = Warp.Location.NONE;
        }

        WarpPlayerToLocation(warpLocation);
    }
示例#2
0
    private void CmdWarpPlayerToLocation(Location location)
    {
        int   warpOffset = -2000;
        float xCoord     = transform.position.x;
        float zCoord     = transform.position.z;

        if (Warp.GetLocation(transform) == location || location == Warp.Location.NONE)
        {
            return;
        }

        if (location == Warp.Location.Blue)
        {
            xCoord -= warpOffset;
        }
        else if (location == Warp.Location.Red)
        {
            xCoord += warpOffset;
        }

        transform.position = new Vector3(xCoord, transform.position.y, zCoord);
    }