示例#1
0
 private void InputChecker() ////Handles the input for the ball
 {
     if (Input.GetButtonDown("Throw") && moveState == MoveState.throwable)
     {
         ThrowToTarget();
         PaddleManager.SetDodge((int)desiredDir);
     }
 }
 void Start()
 {
     //Get reference/Cache
     paddleManager = GameObject.Find("GameObjectPaddleManaerIsAttchedTo").GetComponent <PaddleManager>();
     //To pause
     paddleManager.pause(true);
     //To un-pause
     paddleManager.pause(false);
 }
 // Use this for initialization
 void Start()
 {
     ballScript          = GameObject.FindGameObjectWithTag("Ball").GetComponent <BallScript>();
     mapControllerScript = GameObject.FindGameObjectWithTag("Map").GetComponent <MapController>();
     GetComponent <Renderer>().enabled = false;
     paddleManagerScript = GameObject.Find("PaddleManager").GetComponent <PaddleManager>();
     if (gameObject.tag != "Paddle1")
     {
         paddle1Script = GameObject.FindGameObjectWithTag("Paddle1").GetComponent <PaddleScript>();
     }
 }
示例#4
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#5
0
    public void Initialize(PaddleManager pm)
    {
        this.paddleManager = pm;
        this.speed         = pm.speed;
        this.paddleAxis    = pm.paddleAxis;
        this.distFromTrack = pm.distFromTrack;
        this.yValue        = pm.yValue;
        this.bounds        = pm.bounds;

        InitializeLEDs();
    }
示例#6
0
    public void Initialize(PaddleManager pm)
    {
        material = GetComponent <MeshRenderer>().material;
        sc       = FindObjectOfType <SongController>();
        TurnLEDOff();
        beatsPerLoop = pm.beatsPerFlash;
        float toggleDelay = (float)order / 10f;
        float toggleRate  = sc.ToTime(beatsPerLoop);

        InvokeRepeating("ToggleLED", 2.0f - toggleDelay, toggleRate);
        InvokeRepeating("ToggleLEDOff", 2.0f - toggleDelay + 0.2f, toggleRate);
    }
示例#7
0
    /**
     * Called when the Game starts
     */
    public bool Initialize(SongData song)
    {
        ResetGameTime();

        //OHCamera ohCam = FindObjectOfType<OHCamera>();
        inputMaster    = FindObjectOfType <InputHandler>().inputMaster;
        uIManager      = FindObjectOfType <UIManager>();
        songController = FindObjectOfType <SongController>();
        paddleManager  = FindObjectOfType <PaddleManager>();
        track          = FindObjectOfType <Track>();
        ballDropper    = FindObjectOfType <BallDropper>();

        // ENVIRONMENT
        track.Initialize(this);
        //ohCam.Initialize();

        // LOAD SONG
        this.songData = song;
        songController.Initialize(this, inputMaster);
        songController.LoadSong(song);
        songController.onSongEnd += EndGame;

        // PADDLES
        paddleManager.Initialize(this, track);

        // BALLS
        balls = LoadBallData(song.name);
        SortBalls();

        // BALL DROPPER
        ballDropper.Initialize(this, songController, track);
        ballDropper.ballMapName = song.songName;
        waitTimeBeats           = ballDropper.GetTimeToFallBeats();

        // UI
        uIManager.Initialize();
        replayButton = FindObjectOfType <ReplayButton>();
        replayButton.onReplayButtonClicked += RestartGame;

        StartGame();

        return(true);
    }
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = GameRef.Content;

            walls = new Walls(content.Load <Texture2D>("breakout"), game);

            paddleManager = new PaddleManager(content.Load <Texture2D>("breakout_pieces_1"), GameRef);

            mainBall = new Ball(content.Load <Texture2D>("sphere-00"), new Vector2((GameRef.ScreenRectangle.Width / 2) - 16, (paddleManager[paddleManager.activePaddle].position.Y - 16)));

            brickManager = new BrickManager(content.Load <Texture2D>("breakout_pieces_1"));

            scoreLabel          = new Label();
            scoreLabel.Name     = "Score";
            scoreLabel.Position = new Vector2(GameRef.ScreenRectangle.Width - 100, GameRef.ScreenRectangle.Height - 25);
            scoreLabel.Text     = score.ToString();
            controlManager.Add(scoreLabel);
        }
示例#9
0
    private void CheckScore(string _colName)
    {
        if (_colName == "LeftPaddle" && desiredDir == DesiredDir.left)
        {
            ScoreManager.AddScore();
            desiredDir = DesiredDir.right;
            DesiredDirectionVisualiser.SwitchDirectionToShow((int)desiredDir);
            PaddleManager.SetDodge((int)desiredDir);
        }

        else if (_colName == "RightPaddle" && desiredDir == DesiredDir.right)
        {
            ScoreManager.AddScore();
            desiredDir = DesiredDir.left;
            DesiredDirectionVisualiser.SwitchDirectionToShow((int)desiredDir);
            PaddleManager.SetDodge((int)desiredDir);
        }

        else
        {
            Debug.Log("Paddle that's not a paddle has been hit. What.");
        }
    }
 void Awake()
 {
     paddleManager = GameObject.FindObjectOfType <PaddleManager>();
 }
示例#11
0
 // Use this for initialization
 void Start()
 {
     paddleManagerScript = GameObject.Find("PaddleManager").GetComponent <PaddleManager> ();
     Destroy(gameObject, 5f);
 }
    public PaddleAI[] paddles; /////Left paddle should be put at index 0, and right paddle should be put at index 1

    void Awake()
    {
        instance = this;
    }