Exemple #1
0
    IEnumerator _WrongAnswerCoroutine(HackButton oldButton)
    {
        _canBeHacked       = false;
        _currentHackButton = _GenerateHackButton();
        yield return(new WaitForSeconds(DisableTimeOnBackHack));

        Destroy(oldButton.gameObject);
        _canBeHacked = true;

        if (_isNear)
        {
            _currentHackButton.Show();
        }
    }
Exemple #2
0
 public virtual void Start()
 {
     _canBeHacked         = true;
     _currentHackButton   = _GenerateHackButton();
     _remainingKeysTohack = NumberKeysToHack;
 }
Exemple #3
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag != "Player")
        {
            return;
        }

        if (_canBeHacked && _currentHackButton.Hidden)
        {
            _currentHackButton.Show();
        }



        if (_HasPressedSomething() && _canBeHacked)
        {
            //Instantiate (AudioSourcePrototype).GetComponent<SoundEffectController> ().Play (HackingAudio);
            if (HasPressedCorrectly())
            {
                _remainingKeysTohack--;
                _currentHackButton.Correct();
                Destroy(_currentHackButton.gameObject, 3);
                _currentHackButton = _GenerateHackButton();
                if (_remainingKeysTohack > 0)
                {
                    _currentHackButton.Show();
                }

                if (!_isHacking)
                {
                    _isHacking = true;
                }

                if (_retractCoroutine != null)
                {
                    StopCoroutine(_retractCoroutine);
                }

                _retractCoroutine = StartCoroutine(_RetractCoroutine());
            }
            else
            {
                Instantiate(AudioSourcePrototype).GetComponent <SoundEffectController> ().Play(FailAudio);
                _isHacking = false;
                _currentHackButton.Incorrect();
                StartCoroutine(_WrongAnswerCoroutine(_currentHackButton));

                _remainingKeysTohack = NumberKeysToHack;
            }

            UpdateRemainingKeys();

            if (_remainingKeysTohack == 0)
            {
                _isHacked = true;
                Hack();
                _hackedMessage.Show();
                Instantiate(AudioSourcePrototype).GetComponent <SoundEffectController> ().Play(SuccessAudio);

                StopCoroutine(_retractCoroutine);
                if (!CanBeHackedMultipleTimes)
                {
                    //_currentHackButton.Hide ();
                    //Destroy (this);
                    _canBeHacked = false;
                }
                else
                {
                    _canBeHacked = false;
                    StartCoroutine(HideMessageAfterSeconds());
                }
            }
        }
    }
Exemple #4
0
        public void FixedUpdate(HudManager __instance)
        {
            KillButtonHandler.KillButtonUpdate(this, __instance);

            MimicButtonHandler.MimicButtonUpdate(this, __instance);

            HackButtonHandler.HackButtonUpdate(this, __instance);

            if (__instance.KillButton != null && Player.Data.IsDead)
            {
                __instance.KillButton.SetTarget(null);
            }

            if (MimicButton != null && Player.Data.IsDead)
            {
                MimicButton.SetTarget(null);
            }

            if (HackButton != null && Player.Data.IsDead)
            {
                HackButton.SetTarget(null);
            }

            if (MimicList != null)
            {
                if (Minigame.Instance)
                {
                    Minigame.Instance.Close();
                }

                if (!MimicList.IsOpen || MeetingHud.Instance)
                {
                    MimicList.Toggle();
                    MimicList.SetVisible(false);
                    MimicList = null;
                }
                else
                {
                    foreach (var bubble in MimicList.chatBubPool.activeChildren)
                    {
                        if (!this.IsUsingMimic && this.MimicList != null)
                        {
                            Vector2 ScreenMin =
                                Camera.main.WorldToScreenPoint(bubble.Cast <ChatBubble>().Background.bounds.min);
                            Vector2 ScreenMax =
                                Camera.main.WorldToScreenPoint(bubble.Cast <ChatBubble>().Background.bounds.max);
                            if (Input.mousePosition.x > ScreenMin.x && Input.mousePosition.x < ScreenMax.x)
                            {
                                if (Input.mousePosition.y > ScreenMin.y && Input.mousePosition.y < ScreenMax.y)
                                {
                                    if (!Input.GetMouseButtonDown(0) && this.lastMouse)
                                    {
                                        this.lastMouse = false;
                                        this.MimicList.Toggle();
                                        this.MimicList.SetVisible(false);
                                        this.MimicList = null;
                                        RpcSetMimicked(PlayerControl.AllPlayerControls.ToArray().Where(x =>
                                                                                                       x.Data.PlayerName == bubble.Cast <ChatBubble>().NameText.text)
                                                       .FirstOrDefault());
                                        break;
                                    }

                                    this.lastMouse = Input.GetMouseButtonDown(0);
                                }
                            }
                        }
                    }
                }
            }
        }