コード例 #1
0
    void Update()
    {
        if (activateTime + Duration < Time.time)
        {
            DoorsController.Open();
            gameObject.SetActive(false);
            character.MoveVelocity = oldSpeed;
            SetAllChild(false);

            left.DeltaTime = 10000000;
        }
    }
コード例 #2
0
    private void Update()
    {
        if (isGameStart)
        {
            switch (currentState)
            {
            case GameStates.start:
            {
                roundTime -= timeDelta;
                if (roundTime < 0.5)
                {
                    currentState = GameStates.endGame;
                    break;
                }
                leftTime    = roundTime;
                currentType = Random.Range(0, 4);
                if (previousType == currentType)
                {
                    currentType = currentType % 3 + 1;
                }
                previousType = currentType;
                image.color  = UIColors[currentType];
                currentState = GameStates.wait;
                break;
            }

            case GameStates.wait:
            {
                leftTime -= Time.deltaTime;
                if (leftTime <= 0)
                {
                    currentState = GameStates.end;
                    //TODO negative feedback
                    playerLeft.ChangeHealth(-5);
                    playerRight.ChangeHealth(-5);
                }
                if (PanelsPairs[currentType].left.isPressed && PanelsPairs[currentType].right.isPressed)
                {
                    currentState = GameStates.end;
                    playerLeft.ChangeHealth(10);
                    playerRight.ChangeHealth(10);
                }
                break;
            }

            case GameStates.end:
            {
                image.color  = Color.white;
                currentState = GameStates.start;
                break;
            }

            case GameStates.endGame:
            {
                isGameStart = false;
                Debug.Log("Dealed with it");
                Door.Open();
                image.enabled = false;
                //TODO open the door and destroy itself
                break;
            }
            }
        }
    }