예제 #1
0
 public override void TurnOff()
 {
     if (isTurnedOn)
     {
         isTurnedOn = false;
         movingPlatform.Move();
     }
 }
        public IEnumerator MoveDownTest()
        {
            GameObject     gameObject     = new GameObject();
            MovingPlatform movingPlatform = gameObject.AddComponent <MovingPlatform>();

            movingPlatform.Move(Vector3.down);

            Assert.AreEqual(Vector3.down, movingPlatform.transform.position);

            yield return(null);
        }
예제 #3
0
    public void Toggle()
    {
        GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManager>().Play("Switch");

        isOn = !isOn;

        index           = index == 0 ? 1 : 0;
        renderer.sprite = sprites[color * 2 + index];

        foreach (GameObject Device in Devices)
        {
            if (Device.CompareTag("MovingPlat"))
            {
                MovingPlatform Plat = Device.GetComponent <MovingPlatform>();
                Plat.setMoving(!Plat.getMoving());
                if (!Plat.getStarted())
                {
                    Plat.setStarted(true);
                    StartCoroutine(Plat.Move());
                }
            }
            else if (Device.CompareTag("ConveyorBelt"))
            {
                ConveyorBelt Conv = Device.GetComponent <ConveyorBelt>();
                if (Conv.getStoppable())
                {
                    Conv.changeStop();
                }
                else
                {
                    Conv.changeDirection();
                    Debug.Log("Direction Changed");
                }
            }
        }
    }