Exemple #1
0
 public void Switch()
 {
     AudioManager.instance.PlaySound("Switch");
     activated = !activated;
     animator.SetBool("Activated", activated);
     if (activated)
     {
         _targetIActivatable.Activate();
     }
     else
     {
         _targetIActivatable.Deactivate();
     }
 }
Exemple #2
0
    public void OnTriggerExit2D(Collider2D other)
    {
        if (target == null)
        {
            return;
        }
        if (permOpen)
        {
            return;
        }
        if (other.tag.Equals("Player") || other.tag.Equals("Pallet") || other.tag.Equals("PlayerHitbox"))
        {
            target.Deactivate();

            if (anim.GetCurrentAnimatorStateInfo(0).IsName("On") ||
                anim.GetCurrentAnimatorStateInfo(0).IsName("OnLoop"))
            {
                anim.SetTrigger("Uncharge");
            }
            else
            {
                anim.Play("Off");
            }
        }
    }
Exemple #3
0
    void Update()
    {
        var directionalInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        _player.SetDirectionalInput(directionalInput);
        _carryInterface.SetDirectionalInput(directionalInput);

        if (Input.GetKeyDown(KeyCode.Space))
        {
            _player.OnJumpInputDown();
        }

        if (Input.GetKeyUp(KeyCode.Space))
        {
            _player.OnJumpInputUp();
        }

        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            _doorInterface.OnOpenDoorInput();
        }

        if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.E))
        {
            _carryInterface.OnCarryInput();
        }

        if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown(KeyCode.F))
        {
            if (_active != null)
            {
                _active.Deactivate();
                _active = null;
            }
            else
            {
                if (_carryInterface.Activate(energy))
                {
                    _active = _carryInterface;
                }
                else if (_checkpointInterface.Activate(energy))
                {
                    _active = _checkpointInterface;
                }
            }
        }
    }
Exemple #4
0
 public void SwitchActivated()
 {
     activated = !activated;
     AudioManager.instance.PlaySound("Switch");
     if (activated)
     {
         animator.SetBool("Activated", true);
         _targetIActivatable.Activate();
         meshRenderer.material.color = activatedColor;
     }
     else
     {
         animator.SetBool("Activated", false);
         _targetIActivatable.Deactivate();
         meshRenderer.material.color = defaultColor;
     }
 }
Exemple #5
0
 public void Show(IActivatable activatable)
 {
     Init();
     _activatable = activatable;
     _activatable?.Deactivate();
     if (_showable != null)
     {
         _showable.Show(null);
     }
     else
     {
         gameObject.SetActive(true);
         if (_focusable != null)
         {
             _focusable.Focus();
         }
     }
 }
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (searchedInvalids.Contains(other.gameObject))
            {
                return;
            }

            IActivatable foundActivatable = other.gameObject.GetComponentInChildren <IActivatable>();

            if (foundActivatable != null)
            {
                foundActivatable.Deactivate();
            }
            else
            {
                searchedInvalids.Add(other.gameObject);
            }
        }
Exemple #7
0
 private void OnMouseUpAsButton()
 {
     if (isSource)
     {
         foreach (Part connectedObject in wiredObjects)
         {
             IActivatable a = connectedObject.GetComponent(typeof(IActivatable)) as IActivatable;
             if (a != null)
             {
                 if (a.isActivated)
                 {
                     a.Deactivate();
                 }
                 else
                 {
                     a.Activate();
                 }
             }
             a.isActivated = !a.isActivated;
             //connectedObject.GetComponent(connectedObject.GetComponent<MonoBehaviour>().GetType().Name).GetType().GetMethod("Deactivate").Invoke(connectedObject.GetComponent(connectedObject.GetComponent<MonoBehaviour>().GetType().Name), null);
         }
         sourceOn = !sourceOn;
     }
 }
Exemple #8
0
 public void Deactivate()
 {
     _wayPointMovment.Deactivate();
 }