예제 #1
0
파일: Ball.cs 프로젝트: Abaacus/Pong
    void Start()
    {
        pongMaster = PongMaster.instance;
        switch (pongMaster.difficulty)
        {
        default:
            speed = speeds[1];
            break;

        case Difficulty.easy:
            speed = speeds[0];
            break;

        case Difficulty.medium:
            speed = speeds[1];
            break;

        case Difficulty.hard:
            speed = speeds[2];
            break;

        case Difficulty.ultimate:
            speed = speeds[3];
            break;
        }

        Debug.Log("Ball Speed: " + speed);

        rb = GetComponent <Rigidbody>();
        StartCoroutine(GenerateRandomVelocity());
    }
예제 #2
0
    void Awake()
    {
        PongMaster pongMaster = PongMaster.instance;

        pongMaster.timerGUI         = GUIs[0];
        pongMaster.textScoresGUI[0] = GUIs[1];
        pongMaster.textScoresGUI[1] = GUIs[2];
        pongMaster.paddle2          = paddle;
        pongMaster.gameEndTextGUI   = GUIs[3];

        PongMaster.instance.StartGame();
    }
예제 #3
0
파일: PongMaster.cs 프로젝트: Abaacus/Pong
    void Awake()
    {
        if (instance != null)
        {
            Debug.Log("Multiple instances of PongMaster found");
            Destroy(gameObject);
        }

        instance = this;
        DontDestroyOnLoad(this);

        StartCoroutine("WaitToKillGame");
    }
예제 #4
0
    IEnumerator InitializeButtons()
    {
        pongMaster = PongMaster.instance;
        yield return(new WaitUntil(() => pongMaster.loadSettings));

        foreach (ButtonType buttonType in buttonTypes)
        {
            switch (buttonType)
            {
            default:
                Debug.Log("Invalid ButtonType");
                break;

            case ButtonType.launchGame:
                Debug.Log("Adding LaunchGame()");
                button.onClick.AddListener(pongMaster.LaunchGame);
                break;

            case ButtonType.setPlayerType1:
                Debug.Log("Adding SetPlayers(true)");
                button.onClick.AddListener(() => pongMaster.SetPlayers(true));
                break;

            case ButtonType.setPlayerType2:
                Debug.Log("Adding SetPlayers(false)");
                button.onClick.AddListener(() => pongMaster.SetPlayers(false));
                break;

            case ButtonType.quitGame:
                Debug.Log("Adding QuitGame()");
                button.onClick.AddListener(pongMaster.QuitGame);
                break;
            }
        }

        StopCoroutine("InitializeButtons");
    }
예제 #5
0
파일: ScoreWall.cs 프로젝트: Abaacus/Pong
 void Start()
 {
     pongMaster = PongMaster.instance;
 }