Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (CurrentReloadTimer < ReloadTimer && !reloaded)
        {
            CurrentReloadTimer += Time.deltaTime;
        }
        else
        {
            Reload();
            CurrentReloadTimer = 0;
        }

        TargetPlayer.UpdatePosition();
        if (ownPositionTimer <= 0)
        {
            ownPositionTimer = ownPositionFrequency;
            StartCoroutine(BlinkPlayer());
        }
        else
        {
            ownPositionTimer -= Time.deltaTime;
        }

        MapCoordinates coordinates = MapCoordinates.ToMapCoordinates(GetPosition());

        LocalPlayer.data.latitude  = coordinates.Latitude;
        LocalPlayer.data.longitude = coordinates.Longitude;
        DebugText.text             = coordinates.ToString();

        if (Time.time > nextActionTime)
        {
            nextActionTime = Time.time + period;
            if (!waitingResponse && !string.IsNullOrEmpty(TargetPlayer.data.id))
            {
                StartCoroutine(GetOpponentPosition(coordinates));
            }
        }
        if (Input.GetMouseButtonDown(0))
        {
            Tapped();
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        if (PlayerPrefs.HasKey("JunctionPlayerID"))
        {
            playerId = PlayerPrefs.GetString("JunctionPlayerID");
        }
        else
        {
            playerId = System.Guid.NewGuid().ToString();
            PlayerPrefs.SetString("JunctionPlayerID", playerId);
        }
        Debug.Log("GameManger:Start, calling GetAllPositions");
        if (!waitingResponse)
        {
            Debug.Log("GameManger:Start, calling GetAllPositions, waitingResponse = false");

            StartCoroutine(GetAllPositions(MapCoordinates.ToMapCoordinates(GetPosition())));
        }
        Debug.Log("GameManger:Start, called getallpositions");

        ownPositionTimer = ownPositionFrequency;
        reloaded         = true;
    }