void ThrowTheBall() { GameObject go = (GameObject)Instantiate(mazeBall, transform.position, Quaternion.identity); ThrowBall tb = go.GetComponent <ThrowBall>(); tb.Throw(transform.forward * speed); }
private void Update() { if (GameOver) { restartPanel.SetActive(true); } else { restartPanel.SetActive(false); if (ballInScene == null) { ballInScene = GameObject.FindGameObjectWithTag("Ball"); } if (ballInScene != null) { moveBallScript = ballInScene.GetComponent <MoveBall>(); throwBallScript = ballInScene.GetComponent <ThrowBall>(); } if (IsBallThrown && ThrustPower != 0) { moveBallScript.enabled = false; throwBallScript.enabled = true; } } }
// Start is called before the first frame update void Start() { currentState = GameState.Reset; input.text = PlayerPrefs.GetString("ServerIP", "192.168.200.1"); InputText(); tB = throwBall.GetComponent <ThrowBall>(); // serverIP = input; }
void Start() { tb = GetComponent <ThrowBall>(); pm = GetComponent <PlayerMovement>(); pwb = GetComponent <PlayerWithBall>(); rb = ball.GetComponent <Rigidbody2D>(); gsTemp = rb.gravityScale; }
public static void StartDB() { playerName = "Rodrigo"; throwBall1 = new ThrowBall () {name = "Buligão", level = 5}; throwBall2 = new ThrowBall () {name = "Bola do Mouse", level = 3}; throwBall3 = new ThrowBall () {name = "Bola de Pedra", level = 1}; throwBall4 = null; throwBall5 = null; }
public void LocalUpdate(float speed) { if (speed != 0) { isDestroyBall = true; Vector3 new_position = ccObject.GetNewVector(this, speed, t, c, false); // get new position Vector2 SaveInfo = new Vector2(c, t); // save info Vector3 double_position = new Vector3(0, 0, 0); // new position for get direction of ball if (speed > 0) { double_position = ccObject.GetNewVector(this, speed * 5, t, c, true); } else { double_position = ccObject.GetNewVector(this, -speed * 5, t, c, true); } c = (int)SaveInfo.x; t = SaveInfo.y; transform.LookAt(double_position); if (transform.position.y < double_position.y && transform.position.x <= double_position.x) { transform.eulerAngles = new Vector3(0, 0, 180 - transform.eulerAngles.x); } else if (transform.position.y <= double_position.y && transform.position.x > double_position.x) { transform.eulerAngles = new Vector3(0, 0, transform.eulerAngles.x); } else if (transform.position.y >= double_position.y && transform.position.x < double_position.x) { transform.eulerAngles = new Vector3(0, 0, 180 - transform.eulerAngles.x); } else if (transform.position.y > double_position.y && transform.position.x >= double_position.x) { transform.eulerAngles = new Vector3(0, 0, transform.eulerAngles.x); } transform.position = new_position; // set new position off ball ThrowBall tb = this.GetComponent <ThrowBall>(); if (name == "ball" || name == "ball under off" || name == "throw ball off" || name == "ball off") { isDestroyBall = true; } } else { Debug.Log(""); } }
public static List<ThrowBall> LoadThrowBalls() { List<ThrowBall> result = new List<ThrowBall> (); ThrowBall tb1 = new ThrowBall () {name = "T1", level = 5}; ThrowBall tb2 = new ThrowBall () {name = "T2", level = 3}; ThrowBall tb3 = new ThrowBall () {name = "T3", level = 1}; result.Add (tb1); result.Add (tb2); result.Add (tb3); return result; }
private void Start() { BallCurrentState = State.Still; BallThrowPower = ThrowPower.NoPower; moveBallScript = gameObject.GetComponent <MoveBall>(); throwBallScript = gameObject.GetComponent <ThrowBall>(); rb = gameObject.GetComponent <Rigidbody>(); stickCollisionScript = GameObject.Find("Stick").GetComponent <Stick>(); maxDistance = 49.51f; finishCollider = GameObject.Find("Finish Collider").GetComponent <FinishCollider>(); }
private void Start() { Time.timeScale = 1f; GameIsOver = false; LevelWon = false; Score = 0; Coin = 0; moveBallScript = GameObject.Find("Ball").GetComponent <MoveBall>(); moveBallScript.enabled = true; throwBallScript = GameObject.Find("Ball").GetComponent <ThrowBall>(); throwBallScript.enabled = false; ball = GameObject.Find("Ball"); gameOverScreen.SetActive(false); levelWonScreen.SetActive(false); }
public void LoadPausePanel() { ThrowBall ballControl = GameObject.FindGameObjectWithTag("Ball").GetComponent <ThrowBall>(); if (panel.activeInHierarchy) { panel.SetActive(false); bt_pasue.SetActive(true); GameManager.Pause = false; Time.timeScale = 1; } else { panel.SetActive(true); bt_pasue.SetActive(false); Time.timeScale = 0; GameManager.Pause = true; StartCoroutine(Wait(2f, () => ballControl.clearToThrow = false)); } }
// Update is called once per frame void Update() { if (Refuse == null) { if (!searchingForRefuse) { searchingForRefuse = true; StartCoroutine(SearchForRefuse()); } return; } if (Refuse) { ThrowBall throwBall = Refuse.GetComponent <ThrowBall>(); if (throwBall.WasLaunched && Refuse.transform.position.y < LowerBound) { OnShotMissed(Refuse.gameObject); } } }
void Start() { GameObject ballGO = GameObject.FindWithTag("Ball"); if (ballGO != null) { ball = ballGO.GetComponent <ThrowBall>(); } GameObject arrowGO = GameObject.FindWithTag("Arrow"); if (arrowGO != null) { arrowTrans = arrowGO.GetComponent <Transform>(); } transform.localPosition = playerInitPositionLoc; cam = Camera.main; timer = 0.0f; }
public IEnumerator AnimationOfSprite() // animation off object (example: ball, multi-ball etc.)] { bool isAnim = true; ThrowBall tb = SaveComponent.GetComponent <ThrowBall>(); if (tb != null) { if (tb.This_destroyBall || tb.This_multiBall) { isAnim = false; } } if (isAnim) { SaveComponent.AnimationOfBall(0.5f); yield return(new WaitForFixedUpdate()); StartCoroutine("AnimationOfSprite"); } else { yield return(new WaitForFixedUpdate()); } }
void Awake() { throwPaperInstance = this; }