示例#1
0
 protected override void StartDrag()
 {
     if (CustomInputModule.IsPointerOverUI())
     {
         return;
     }
     base.StartDrag();
 }
示例#2
0
        protected virtual void Start()
        {
            _inputModule   = (CustomInputModule)EventSystem.current.currentInputModule;
            _rectTransform = GetComponent <RectTransform>();

            if (_collapseButton != null)
            {
                _collapseButton.SetParentForm(this);
                _collapseButton.SetAction(CollapseButtonClick);
            }
        }
示例#3
0
 protected override void Start()
 {
     base.Start();
     if (!instance)
     {
         instance = this;
         UpdateModule();
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
示例#4
0
 public void ShowWindowUnderMouse()
 {
     if (CustomInputModule.IsPointerOverUI())
     {
         var hovered = CustomInputModule.GetHoveredGameObject();
         if (hovered)
         {
             var window = hovered.GetComponentInParent <Window>();
             if (window)
             {
                 Windows.MoveToTop(window.transform);
             }
         }
     }
 }
        void CheckClicks()
        {
            bool shouldCancel = (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) && currentHandle.HasValue;

            if (shouldCancel)
            {
                Cancel();
            }

            if (Input.GetMouseButtonDown(0))
            {
                if (CustomInputModule.IsPointerBlocked(30))
                {
                    return;
                }

                var pos          = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                var interactable = CheckInteractable(pos);

                if (interactable != null)
                {
                    if (currentHandle.HasValue)
                    {
                        Cancel();
                    }
                    MoveTo(interactable.PlayerStandPosition, Speed, interactable.Interact);
                }
            }

            if (Input.GetMouseButtonDown(1))
            {
                if (CustomInputModule.IsPointerBlocked(30))
                {
                    return;
                }

                if (currentHandle.HasValue)
                {
                    Cancel();
                }
                var pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                MoveTo(pos, Speed, null);
            }
        }
示例#6
0
        void CheckClicks()
        {
            if (Clock.Paused)
            {
                return;
            }

            bool shouldCancel = (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) && currentHandle.HasValue;

            if (shouldCancel)
            {
                Cancel();
            }

            if (!Input.GetMouseButtonDown(0) && !Input.GetMouseButtonDown(1))
            {
                return;
            }
            Vector3       pos          = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            IInteractable interactable = CheckInteractable(pos);

            if (Input.GetMouseButtonDown(0))
            {
                if (CustomInputModule.IsPointerBlocked(30))
                {
                    return;
                }

                if (interactable != null)
                {
                    if (currentHandle.HasValue)
                    {
                        Cancel();
                    }
                    currentTarget = interactable;
                    Action action = interactable.interactionOptions.UpdateCharacterOrientation;
                    //henrique - added the option to check if the Interface that displays options in a menu
                    var menuOptions = interactable.gameObject.GetComponent <ImenuInteraction>();
                    if (menuOptions != null)
                    {
                        action += menuOptions.OpenMenu;
                    }
                    else
                    {
                        action += interactable.Interact;
                    }
                    MoveTo(interactable.interactionOptions.PlayerStandPosition, Speed, action);
                }
            }

            if (Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(0) && CheckInteractable(pos) == null)
            {
                if (CustomInputModule.IsPointerBlocked(30))
                {
                    return;
                }

                if (currentHandle.HasValue)
                {
                    Cancel();
                }

                if (interactable != null)
                {
                    Action action = interactable.interactionOptions.UpdateCharacterOrientation;
                    MoveTo(interactable.interactionOptions.PlayerStandPosition, Speed, action);
                }
                else
                {
                    MoveTo(pos, Speed, null);
                }
            }
        }
示例#7
0
    //------------------------------------------------------------------
    void Awake()
    {
        #region SINGLETON
        //Check if instance already exists
        if (instance == null)
        {
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        #endregion

        // Sum up scenes and enemies
        totalScenes = maxEasyScenes + maxMediumScenes + maxHardScenes;
        maxEnemy    = maxBats + maxNinja + maxKamikaze + maxSpiders + maxDogs + maxSentinel; //sum if all enemy types

        //Get all the players required for the current game mode
        if (currentMode != GAMEMODE.Menu)
        {
            inGame = true;

            // if the total score array doesn't exist the initialize one
            if (playersTotalScore == null)
            {
                playersTotalScore = new int[playersRequired];
            }

            // GETS THE REQUIRED COMPONENTS FOR THIS MODE
            UI                 = FindObjectOfType <UIManager3D>();
            bonusWeapon        = UI.rewardPanel.GetComponent <BonusWeapon>();
            currentEventSystem = UI.eventSystem;
            inputModule        = currentEventSystem.GetComponent <CustomInputModule>();
            CrescentScoreOrder = new int[playersRequired];
            for (int i = 0; i < CrescentScoreOrder.Length; i++)
            {
                CrescentScoreOrder[i] = -1;
            }
            playerInfo = new PlayerInfo[playersRequired];

            //spawn players and add them to the current playerInfo list, collect spawn and enemy info
            PlayerSetup();
            StartEnemyCount();
            CollectEnemySpawns();
            CollectWeaponSpawns();
            // set tension threshold and max bar dimension
            currentTensionMax = (int)(tensionStats.standardBarCapacity * (1 + (tensionStats.multiXPlayer * (playerInfo.Length - 1))));
            tensionThreshold  = currentTensionMax / tensionStats.barDivision;
            TensionBonusSetup();

            //check if controller get connected/disconnected, MUST BE CALLED AFTER THE PLAYER SETUP
            StartCoroutine(ControllerCheck());

            // if the current level is not the first of the current game
            if (levelCount > 1)
            {
                // add weapon of choice
                for (int i = 0; i < playerInfo.Length; i++)
                {
                    SetStartingWeapon(i);
                }
            }
            else
            {
                weaponRewardFromLastLevel = new Weapon3D[playersRequired];
            }
        }

        // refill the scene pool and reset total scores, weaponRewards
        if (currentMode == GAMEMODE.Menu)
        {
            currentEventSystem = GameObject.FindWithTag("EventSystem").GetComponent <EventSystem>();
            inputModule        = currentEventSystem.GetComponent <CustomInputModule>();

            // if there are no inputs selected then assign defaults
            if (selectedInputConfig == null)
            {
                selectedInputConfig = new CharacterControlConfig[playersRequired];
            }

            //check if controller get connected/disconnected
            StartCoroutine(MenuInputCheck());

            inGame            = false;
            currentEasyScenes = new List <string>();
            for (int i = 0; i < easyScenes.Count; i++)
            {
                currentEasyScenes.Add(easyScenes[i]);
            }
            currentMediumScenes = new List <string>();
            for (int i = 0; i < mediumScenes.Count; i++)
            {
                currentMediumScenes.Add(mediumScenes[i]);
            }
            currentHardScenes = new List <string>();
            for (int i = 0; i < hardScenes.Count; i++)
            {
                currentHardScenes.Add(hardScenes[i]);
            }

            weaponRewardFromLastLevel = null;
            playersTotalScore         = null;
            levelCount = 0;
        }
    }