예제 #1
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Player")
     {
         Gate.Open();
         SoundOrigin.PlaySound(ClickSound);
     }
 }
예제 #2
0
    private void OnTriggerEnter2D()
    {
        sprite.color = activatedColor;
        linkedGate.Open();
        activationSound.Play();

        // Once the gate has been triggered to open, the switch can safely be disabled.
        GetComponent <Collider2D>().enabled = false;
    }
 public void GateEntered()
 {
     if (!_isPlayerAtGate)
     {
         //Debug.Log("yo you entered the gate to heaven");
         _gateController.Open();
         _isPlayerAtGate = true;
         PayGhosts();
     }
 }
예제 #4
0
 private void OpenGate()
 {
     if (activeGateController.IsClosed() && !activeGateController.IsSealed())
     {
         //DLog.Log("Open gate");
         int indexOfActiveStage = stages.IndexOf(activeStage);
         NotifyStageCycle(indexOfActiveStage + 1, StageCycle.Clear);
         activeGateController.Open();
         activeGateComponent = new GateComponent(activeGateController);
         AddComponent(activeGateComponent);
     }
 }
예제 #5
0
        public IEnumerator GateShouldOpenUp()
        {
            GateController gc = GameObject.Find("RedGate").GetComponent <GateController>();

            gc.OpenDirection = Direction.Up;

            Vector3 startPos      = gc.transform.position;
            Vector3 assumedEndPos = new Vector3(startPos.x, startPos.y, startPos.z + 1);

            gc.Open();
            yield return(new WaitForSeconds(waitTime));

            Assert.True(gc.transform.position == assumedEndPos);
        }
예제 #6
0
        public IEnumerator GateShouldComeBackToOriginalPositionWhenClosing()
        {
            GateController gc = GameObject.Find("RedGate").GetComponent <GateController>();

            gc.OpenDirection = Direction.Down;

            Vector3 startPos = gc.transform.position;

            gc.Open();
            yield return(new WaitForSeconds(waitTime));

            gc.Close();
            yield return(new WaitForSeconds(waitTime));

            Assert.True(gc.transform.position == startPos);
        }