Exemple #1
0
        //a method that is called when a mouse click on this portal is detected
        public void OnMouseClick()
        {
            if (!IsActive) //if the component is not active, do not continue
            {
                return;
            }

            if (clickedOnce == false)
            {                            //if the player hasn't clicked on this portal shortly before this click
                doubleClickTimer = 0.5f; //launch the double click timer
                clickedOnce      = true; //change to true to mark that the second click (to finish the double click) is awaited
            }
            else if (targetPortal != null)
            {                                                                             //if this is the second click (double click)
                CustomEvents.OnPortalDoubleClick(this, targetPortal, null);               //trigger the custom event

                AudioManager.Play(gameMgr.GetGeneralAudioSource(), teleportAudio, false); //play the teleport audio clip
                gameMgr.CamMgr.LookAt(targetPortal.transform.position, false);            //change the main camera's view to look at the target portal
                //gameMgr.CamMgr.SetMiniMapCursorPos(targetPortal.transform.position); //change the minimap's cursor position to be over the target portal
            }
        }