예제 #1
0
 // Initialisation
 void Start()
 {
     forwardKey.text        = KeyBoardBindings.GetForwardKey().ToString();
     backwardKey.text       = KeyBoardBindings.GetBackwardKey().ToString();
     attackKey.text         = KeyBoardBindings.GetAttackKey().ToString();
     chargedAttackKey.text  = KeyBoardBindings.GetChargedAttackKey().ToString();
     pauseKey.text          = KeyBoardBindings.GetPauseKey().ToString();
     zoomInKey.text         = KeyBoardBindings.GetZoomInKey().ToString();
     zoomOutKey.text        = KeyBoardBindings.GetZoomOutKey().ToString();
     showScoreboardKey.text = KeyBoardBindings.GetScoreboardKey().ToString();
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!playerScript.isLocalPlayer)
        {
            return;
        }

        // find remoteplayers & add
        if (lengthPlayerGo != GameObject.FindGameObjectsWithTag("Player").Length)
        {
            addPlayerToRadar();
            ++lengthPlayerGo;
        }

        DrawRadarDots();

        for (int i = 0; i < worldObject.Count; ++i)
        {
            // the position of all the gameobjects on the map
            Vector3 radarPos         = worldObject[i].transform.position;
            Vector3 worldObjectScale = worldObject[i].transform.localScale;

            // the position of players
            Vector3 playerPos = PlayerUI.playerPos;//playerScript.transform.position;


            // check for gameobject above the player
            if (radarPos.y - worldObjectScale.y > (playerPos.y + offsetY))
            {
                radIcons[i].iconHigher.gameObject.SetActive(true);
                radIcons[i].iconLower.gameObject.SetActive(false);
                radIcons[i].icon.gameObject.SetActive(false);
                radIcons[i].currentIcon = radIcons[i].iconHigher;
            }
            // check for gameobject below the player
            else if (radarPos.y + worldObjectScale.y < (playerPos.y - offsetY))
            {
                radIcons[i].iconHigher.gameObject.SetActive(false);
                radIcons[i].iconLower.gameObject.SetActive(true);
                radIcons[i].icon.gameObject.SetActive(false);
                radIcons[i].currentIcon = radIcons[i].iconLower;
            }
            // in the middle
            else
            {
                radIcons[i].iconHigher.gameObject.SetActive(false);
                radIcons[i].iconLower.gameObject.SetActive(false);
                radIcons[i].icon.gameObject.SetActive(true);
                radIcons[i].currentIcon = radIcons[i].icon;
            }
        }

#if !UNITY_ANDROID
        // zoom in/out
        if (Input.GetKeyDown(KeyBoardBindings.GetZoomInKey()))
        {
            this.ZoomIn();
        }
        else if (Input.GetKeyDown(KeyBoardBindings.GetZoomOutKey()))
        {
            this.ZoomOut();
        }
        if (Input.GetAxis("Mouse ScrollWheel") != 0f)   // mouse scroll
        {
            mapScale += 0.01f * Input.GetAxis("Mouse ScrollWheel");
            //if (mapScale < 0.02f)
            //    mapScale = 0.002f;
            //
            //if (mapScale > 0.05f)
            //    mapScale = 0.005f;
        }
#endif
    }   // end of Update()