Inheritance: MonoBehaviour
 private void Start()
 {
     theBall = FindObjectOfType <BallControl>();
     for (int i = 0; i < numGarbage; i++)
     {
         spawnGarbage();
     }
 }
Exemple #2
0
 private void Awake()
 {
     if (S == null)
     {
         S = this;
     }
     Time.timeScale = 0.7f;
 }
Exemple #3
0
    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Ball"))
        {
            BallControl ball = other.gameObject.GetComponent <BallControl>();

            ball.ModifyFireBall(speedModifier);     // Call the modify function to set to fireball
        }
    }
Exemple #4
0
 void Start()
 {
     specialItemManager  = FindObjectOfType <SpecialItemManager>();
     ballControl         = FindObjectOfType <BallControl>();
     gameManager         = FindObjectOfType <GameManager> ();
     ballWaitTimeSeconds = ballWaitTime;
     numberOfExtraBalls  = 1;
     numberOfBallsToFire = 1;
 }
Exemple #5
0
    // Start is called before the first frame update
    void Start()
    {
        var ballObj = GameObject.FindGameObjectWithTag("Ball");

        if (ballObj != null)
        {
            Ball = ballObj.GetComponent <BallControl>();
        }
    }
Exemple #6
0
    private void OnDisable()
    {
        BallControl ball = FindObjectOfType <BallControl>();

        if (ball)
        {
            Destroy(ball.gameObject);
        }
    }
Exemple #7
0
 private void OnTriggerEnter2D(Collider2D hitInfo)
 {
     if (hitInfo.name == "Ball")
     {
         string wallName = transform.name;
         BallControl.Score(wallName);
         hitInfo.gameObject.SendMessage("RestartGame", 1.0f, SendMessageOptions.RequireReceiver);
     }
 }
Exemple #8
0
    void Start()
    {
        radialBar   = GameObject.Find("RadialBar").GetComponent <ProgressRadialBehaviour>();
        ball        = this.gameObject;
        _rigidbody  = GetComponent <Rigidbody> ();
        ballControl = GetComponent <BallControl>();

        Reset();
    }
 // Use this for initialization
 void Start()
 {
     ball         = GameObject.FindObjectOfType <BallControl>();
     cam          = GameObject.FindObjectOfType <CameraFollow>();
     ballsound    = GameObject.FindObjectOfType <BallSound>();
     pinsetter    = GameObject.FindObjectOfType <PinSetter> ();
     pincounter   = GameObject.FindObjectOfType <PinCounter> ();
     swip         = GameObject.FindObjectOfType <Swiper> ();
     scoreDisplay = GameObject.FindObjectOfType <ScoreDisplay> ();
 }
Exemple #10
0
    void OnTriggerExit(Collider col)
    {
        BallControl ball = col.GetComponent <BallControl>();

        if (ball)
        {
            //Debug.Log("BallHasEntered");
            BallInGoal = false;
        }
    }
    //private Animator anim;						// Reference to the Animator on the player
    void Awake()
    {
        // Setting up references.
        ballControl = GetComponent<BallControl>();
        healthBar = GameObject.Find("HealthBar").GetComponent<SpriteRenderer>();
        //anim = GetComponent<Animator>();

        // Getting the intial scale of the healthbar (whilst the player has full health).
        healthScale = healthBar.transform.localScale;
    }
Exemple #12
0
    public void OnTriggerEnter(Collider other)                                          //Called when the ball enters the zone
    {
        BallControl ballControl = other.GetComponent <BallControl>();                   //Get the ball control

        if (ballControl)
        {
            ballControl.Die();                                                          //Destroy the ball and respawn
            pongManager.lives--;                                                        //Update the manager
        }
    }
Exemple #13
0
 private void Start()
 {
     mRigidBody = GetComponent <Rigidbody>();
     Debug.Assert(mRigidBody != null);
     lastCallTime   = (int)(Time.time * 1000) + IntervalMilliseconds;
     ballController = UseManualBallController ? (BallControl) new ManualBallControl() : new AutoBallControl();
     ballController.SetMaze();
     if (MazeDescription.IsConsoleRun())
     {
         Time.timeScale = 100.0f;
     }
 }
Exemple #14
0
    //public GameObject ballcontroll;


    // Use this for initialization
    void Start()
    {
        theText = GetComponent <TextMeshProUGUI>();

        scoremanager = GetComponent <ScoreManager>();

        Timecounter = startingtime;

        BallControl = GetComponent <BallControl>();

        BallRespawn = GetComponent <BallRespawn>();
    }
Exemple #15
0
 // Use this for initialization
 void Start()
 {
     ballControl = GetComponent <BallControl>();
     //Create player camera
     if (createCamera)
     {
         CameraPivot cpivot = (CameraPivot)Instantiate(cameraPivotObject);
         cpivot.name   = "CameraPivot_" + this.gameObject.name;
         cpivot.target = ballControl.gameObject;
         cameraPivot   = cpivot.GetComponent <SmoothMouseLook>();
     }
 }
Exemple #16
0
    //// Start is called before the first frame update
    void Start()
    {
        ExistingChunks      = new Dictionary <Vector3Int, Chunk>();
        BlankChunkPositions = new List <Vector3>();
        tris = new List <Triangle>();
        recycleableChunks = new Queue <Chunk>();
        Chunks            = new List <Chunk>();
        CreateChunkParentObject();

        //get player
        player           = GameObject.FindGameObjectWithTag("Player");
        playerController = player.GetComponent <BallControl>();
    }
Exemple #17
0
    private Vector3 direction;                             //direction in which the ball will be shot

    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        rgBody = GetComponent <Rigidbody>();                 //get reference to the rigidbody
    }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        ballControl = GetComponent <BallControl>();
        //PathToFollow
        pathToFollow = GameObject.FindWithTag("AIPath").GetComponent <Path>();
        //PathFollower
        AITarget pFollower = (AITarget)Instantiate(aiTargetPrefab);

        pFollower.GetComponent <PathFollower>().path = pathToFollow;
        pFollower.stupidness = stupidness;
        pFollower.GetComponent <Patroller>().target = this.gameObject;
        target = pFollower;
    }
Exemple #19
0
    void Start()
    {
        ball_control = ball.GetComponent <BallControl>();

        connections = new List <IPEndPoint>();

        client = new UdpClient(1234);

        inbound_t = new Thread(new ThreadStart(Inbound));
        inbound_t.Start();

        self = this;
    }
Exemple #20
0
    // Use this for initialization
    void Start()
    {
        GameObject theBall = GameObject.FindGameObjectWithTag("Ball");

        this.ballControl = theBall.GetComponent <BallControl>();
        this.ballControl.setGameManager(this);

        PlayerScore1              = 0;
        PlayerScore2              = 0;
        this.leftPlayerText.text  = PlayerScore1.ToString();
        this.rightPlayerText.text = PlayerScore2.ToString();
        this.gameOver             = false;
        this.blackPanel.GetComponent <BlackPanelScript>().FadeInGame();
    }
Exemple #21
0
 void GetBall()
 {
     for (int i = 0; i < ballsParent.transform.childCount; ++i)
     {
         if (ballsParent.transform.GetChild(i).GetComponent <BallControl>())
         {
             ball = ballsParent.transform.GetChild(i).GetComponent <BallControl>();
         }
     }
     if (!ball)
     {
         Debug.Log("Error getting ball in UI Control");
     }
 }
Exemple #22
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Screen.sleepTimeout         = SleepTimeout.NeverSleep;

        script = this;
        rb     = GetComponent <Rigidbody>();
        rend   = GetComponent <Renderer>();
        health = 3;
        score  = 0;
        alive  = true;


        TextHealth.GetComponent <TextMeshPro>().text = health + "";
    }
Exemple #23
0
    // Use this for initialization
    void Start()
    {
        Transform ballsParent = GameObject.Find("Balls").transform;
        int       childCount  = ballsParent.childCount;

        ball = ballsParent.GetChild(childCount - 1).GetComponent <BallControl>();
        if (!ball)
        {
            Debug.Log("unable to get ball object");
        }
        ball.spaceKeyObserver += SpaceKeyHandler_PowerBarControl;
        powerBar          = gameObject.GetComponent <Slider>();
        powerBar.value    = 0;
        instantiationTime = Time.timeSinceLevelLoad;
    }
Exemple #24
0
    void Start()
    {
        ball_control = ball.GetComponent <BallControl>();

        endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1234);

        client = new UdpClient();
        client.Connect(endpoint);
        connected = true;

        inbound_t = new Thread(new ThreadStart(Inbound));
        inbound_t.Start();

        self = this;
    }
Exemple #25
0
    // Start is called before the first frame update
    void Start()
    {
        theBall           = GameObject.FindGameObjectWithTag("Ball");
        ballControlScript = theBall.GetComponent <BallControl>();

        theCircuitGrid           = GameObject.FindGameObjectWithTag("CircuitGrid");
        circuitGridControlScript = theCircuitGrid.GetComponent <CircuitGridControl>();

        theClassicalPaddle           = GameObject.FindGameObjectWithTag("ClassicalPaddle");
        classicalPaddleControlScript = theClassicalPaddle.GetComponent <ComputerControls>();

        arcadeButtonInput = gameObject.GetComponent <ArcadeButtonInput>();
        player            = GameController.Instance.player;

        RestartGame();
    }
Exemple #26
0
    IEnumerator OneByOneShoot()
    {
        int HowMany = GameObject.Find("GameManager").GetComponent <GameManager>().ballCount;

        for (int eachBall = 0; eachBall < HowMany; eachBall++)
        {
            GameObject newBall = Instantiate(ballSample, ballSample.transform.position, Quaternion.identity);
            GameObject.Find("GameManager").GetComponent <GameManager>().ballCount--;
            newBall.SetActive(true);
            newBall.transform.parent = gameObject.transform;
            BallControl control = newBall.GetComponent <BallControl>();
            control.Angle = Mathf.Atan(BallDirection.y / BallDirection.x);
            control.PushBall();
            yield return(new WaitForSeconds(0.1f)); // Time Wait until Next Ball will be Shoot
        }
    }
Exemple #27
0
//fazer um codigo separado do rangetouch para nao dar conflit com colider da ball
//animação trava qualquer modificação feita apos ela entao fizque atento a isso


//jogo vai ser girtado em torno dos PASSES  duas vidas uma se errrar outra pra tentar de novo acertar os passes

    private void Awake()
    {
        //pode bugar isso na frente qualquer cosia da uma olhada aqui

        instance = this;
        DontDestroyOnLoad(this.gameObject);


        forceSpriteMask = forceTransform.Find("mask").GetComponent <SpriteMask>();
        rangeTouch      = GameObject.Find("RageTouch");
        HideForce();


        bolaRB             = GetComponent <Rigidbody2D>();
        liberaProximoChute = true;
    }
Exemple #28
0
    public bool isDestroyed = false, pallinoDestroyed = false; //Checks if a balls were shredded

    void GetPallino()
    {
        int childCount = ballsParent.transform.childCount;

        for (int i = 0; i < childCount; ++i)
        {
            if (ballsParent.transform.GetChild(i).GetComponent <PallinoControl>())
            {
                ball = ballsParent.transform.GetChild(i).GetComponent <BallControl>();
            }
        }
        if (!ball)
        {
            Debug.Log("Error getting pallino in UI control");
        }
    }
 private void Start()
 {
     rigidBody = GetComponent <Rigidbody>();
     Debug.Assert(rigidBody != null);
     lastCallTime   = (int)(Time.time * 1000) + IntervalMilliseconds;
     ballController = UseManualBallController ? (BallControl) new ManualBallControl() : new AutoBallControl();
     try { ballController.SetMaze(); }
     catch (Exception exception) { if (Debug.isDebugBuild)
                                   {
                                       throw exception;
                                   }
                                   Application.Quit(1); }
     if (MazeDescription.IsConsoleRun())
     {
         Time.timeScale = 100.0f;
     }
 }
Exemple #30
0
    // Update is called once per frame
    void Update()
    {
        int ballsComplete = 0;

        for (int i = 0; i < mazeCount; i++)
        {
            ballControl = balls[i].GetComponent <BallControl>();
            if (ballControl.xCoordinate >= mazeWidth - 1 && ballControl.zCoordinate >= mazeHeight - 1)
            {
                ballControl.ballComplete = true;
                ballsComplete           += 1;
            }
        }

        if (ballsComplete == mazeCount)
        {
            Debug.Log("Game Won");
        }
    }
Exemple #31
0
    public Racer SpawnLobbyBall(ServerPlayer sp, bool isLocal)
    {
        Character c = Global.characters[sp.character]; //Get character for player
        Object    o;

        if (sp.player == Network.player)
        {
            o = ballPlayerLobbyPrefab;
        }
        else
        {
            o = ballRemoteLobbyPrefab;
        }
        Racer r = (Racer)Instantiate(o, new Vector3(0, 8, -4), Quaternion.Euler(0, 90, 25));

        r.name = o.name + "-" + sp.name;
        //Set character traits
        r.racerName         = sp.name;
        r.renderer.material = c.material;
        r.mapIconMaterial   = c.minimapIcon;
        r.GetComponent <TrailRenderer>().material = c.trail;
        BallControl bc = r.GetComponent <BallControl>();

        if (c.alternativeMesh != null)
        {
            r.GetComponent <MeshFilter>().mesh = c.alternativeMesh;
        }
        if (bc != null)
        {
            bc.stats = c.stats;
        }
        r.transform.localScale = new Vector3(c.ballSize, c.ballSize, c.ballSize);
        if (o == ballRemoteLobbyPrefab)
        {
            GUIText label = r.transform.FindChild("ObjectLabel").guiText;
            label.text  = sp.name;
            label.color = PlayerTypeHandler.GetPlayerColor(sp.type);
        }
        return(r);
        //Do more stuff
        //r.RaceController = raceController;
        //r.totalLaps = (int)settings.laps;
    }
Exemple #32
0
 void Start()
 {
     ballControl = this.GetComponent<BallControl>();
 }
 void Awake()
 {
     myBallControl = GameObject.FindGameObjectWithTag("Ball").GetComponent<BallControl>();
 }