Exemple #1
0
        public bool IsOnHover()
        {
            bool hover = false;

            if (actionButtons != null)
            {
                foreach (Button button in actionButtons)
                {
                    InteractButton interactButton = button.GetComponentInChildren <InteractButton>();
                    if (interactButton != null)
                    {
                        if (interactButton.IsOnHover)
                        {
                            hover = true;
                        }
                    }
                }
            }

            if (progressButton != null)
            {
                if (progressButton.IsOnHover)
                {
                    hover = true;
                }
            }

            return(hover);
        }
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         GameObject.Destroy(this.gameObject);
     }
     Instance = this;
 }
Exemple #3
0
 public void LinkInteractButton(bool ifLink)
 {
     if (ifLink)
     {
         InteractButton.SetInteractTarget(gameObject);
         InteractButton.SetInteractButton(true);
     }
     else
     {
         InteractButton.SetInteractTarget(null);
         InteractButton.SetInteractButton(false);
     }
 }
    public override void DrawMe()
    {
        if (Time.time < _lastActivation + _activateLockout)
        {
            return;
        }

        if (InteractButton.IsClicked() ||
            _controlManager.GetAxisUp("Interact"))
        {
            _maestro.PlayOneShot(ButtonSound);

            CanActivate = false;
            SetVisibility(false);

            TextThread thread;
            if (!IsTaken)
            {
                DebugMessage("The item is available...taking it.");

                IsTaken = true;
                _spriteSystem.PlaySingleFrame(OpenChestAnimation);
                _treasureManager.MarkTreasureAsObtained(TreasureName);

                thread = _entityText.GetThreadByName(ItemGetThreadName);
                if (thread == default(TextThread))
                {
                    DebugMessage("The entity text has no thread named " + ItemGetThreadName);
                }
            }
            else
            {
                DebugMessage("There is no item in the chest.");
                thread = _entityText.GetThreadByName(TakenThreadName);

                if (thread == default(TextThread))
                {
                    DebugMessage("The entity text has no thread named " + TakenThreadName);
                }
            }

            if (thread == default(TextThread))
            {
                DebugMessage("Could not find a thread that corresponds to the treasure's state!", LogLevel.LogicError);
            }
            else
            {
                _dialogueController.PresentTextThread(thread);
            }
        }
    }
    public override void InitTask()
    {
        try
        {
            foreach (KeyValuePair <InteractButton, bool> entry in buttons)
            {
                InteractButton button = entry.Key;
                bool           active = entry.Value;

                if (active)
                {
                    button.ButtonClicked();
                    buttons[button] = false;
                }
            }
        }
        catch (InvalidOperationException e)
        {
            return;
        }
    }
    public void ReportFromButton(InteractButton button)
    {
        if (buttons.ContainsKey(button))
        {
            bool active = button.Activated;
            buttons[button] = active;

            if (active)
            {
                currentClearedTasks++;
            }
            else
            {
                currentClearedTasks--;
                tutorialArea.ReportBackwardProgress(this);
            }

            if (currentClearedTasks == numberOfTasks)
            {
                tutorialArea.ReportForwardProgress(this);
            }
        }
    }
 void OnDestroy()
 {
     Instance = null;
 }