Exemple #1
0
    void Update()
    {
        if (!PauseControl.gameIsPaused)
        {
            if (contentToSpawn != null && !Input.GetKeyDown(KeyStrokeUtil.GetKeyStroke(contentToSpawn.PlayerPrefKey, contentToSpawn.DefaultKeyStroke)))
            {
                contentToSpawn = null;
            }

            if (contentToSpawn == null)
            {
                foreach (SpawnContentByShortcut spawnContent in spawnContents)
                {
                    spawnContent.timePassedDoNotTouch -= Time.deltaTime;
                    if (Input.GetKeyDown(KeyStrokeUtil.GetKeyStroke(spawnContent.PlayerPrefKey, spawnContent.DefaultKeyStroke)) && player.GetRewardAmountCollected() >= spawnContent.RewardCost && spawnContent.timePassedDoNotTouch <= 0f)
                    {
                        contentToSpawn = spawnContent;
                        spawnContent.timePassedDoNotTouch = spawnContent.CoolDown;
                        GameObject newInstance = PoolManager.Spawn(contentToSpawn.Prefab, player.GetMover().GetNavMeshAgent().destination);
                        if (!String.IsNullOrEmpty(contentToSpawn.SpawnSound))
                        {
                            FMODUnity.RuntimeManager.PlayOneShotAttached(contentToSpawn.SpawnSound, newInstance);
                        }
                        player.DecrementRewardCollected(contentToSpawn.RewardCost);
                    }
                }
            }
        }
    }
 private void CheckControl()
 {
     CheckOnRightClick();
     if (Input.GetKeyDown(KeyStrokeUtil.GetKeyStroke(PlayerPrefKey.AttackKeyStroke, DefaultKeyStroke.Attack)))
     {
         Attack();
     }
 }
Exemple #3
0
    void Start()
    {
        thisbutton = this.GetComponent <Button>();
        thisbutton.onClick.AddListener(TaskOnClick);
        currentKeyStroke = KeyStrokeUtil.GetKeyStrokeChar(playerPrefKey, defaultKeyStroke).ToString();
        this.transform.Find("Button").GetComponentInChildren <TMP_Text>().text = currentKeyStroke;

        inputPanel = this.transform.Find("input").gameObject;
        inputField = inputPanel.GetComponentInChildren <InputField>();
        inputField.characterLimit = 1;
        inputField.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
    }