// Start is called before the first frame update void Start() { // set the game manager instance, add the listener to the cancel button _gameManager = GameManager.Instance; cancelButton.onClick.AddListener(OnClick); // make the target score for the player and display it CreateDisplayTargetScore(); _pongManager = GameObject.Find("PongManager").GetComponent <PongManager>(); _partnerOwner = _gameManager.GetManagerOwnerName(); // we get the owner of the arcade machine from the game manager // it's in the game manager because the scope of the arcade machine owner transcends a single scene. // it will be used for scoring the managers. // makes sure that score to win is above minimum for game objectives to work. if (scoreToWin < 2) { scoreToWin = 2; } }
public override void OnStartClient() { CanvasScaler scaler = transform.GetComponent <CanvasScaler>(); Bar.deltaScaler = scaler.referenceResolution.y / Screen.height; Transform panel = transform.Find("Panel"); oppBar = panel.Find("OppBar").GetComponent <Bar>(); ball = panel.Find("Ball").GetComponent <Ball>(); ball.Reset(); mainMenu = panel.GetComponent <LobbyMainMenu>(); if (NetworkClient.allClients.Count > 0) { NetworkClient client = NetworkClient.allClients[0]; client.RegisterHandler(PongMsgType.Start, OnStartMessage); PongMessage.client = client; } string user_id, token; PongManager.GetUserIdAndToken(out user_id, out token); PongMessage.SendReady(user_id, token); }
private void OnTriggerEnter2D(Collider2D collision) { //if (collision.gameObject.name == "") //if (collision.gameObject.tag == "") if (collision.gameObject.CompareTag("Match/Paddle")) { rigid.velocity = -rigid.velocity; collision.gameObject.transform.parent.GetComponent <Animator>().SetTrigger("willHit"); } else if (collision.gameObject.CompareTag("Match/Goal")) { print("GOLO DO MAREGA"); //StartCoroutine(GameObject.Find("Manager").GetComponent<PongManager>().StartBall()); if (collision.gameObject.name == "WallRight") { GlobalVariablesManager.Instance.PointsP1++; } else { GlobalVariablesManager.Instance.PointsP2++; } print("SCORE P1: " + GlobalVariablesManager.Instance.PointsP1 + " P2: " + GlobalVariablesManager.Instance.PointsP2); PongManager auxManager = GameObject.Find("Manager").GetComponent <PongManager>(); auxManager.ChangeState(PongManager.MatchState.ready); auxManager.ChangeScoreText(); } else if (collision.gameObject.CompareTag("Match/Wall")) { rigid.velocity = new Vector2(rigid.velocity.x, -rigid.velocity.y); } }
public Ball(Vector2 startPosition, float size, float speed, float speedIncrement) { Position = startPosition; Size = size; Speed = speed; _speedIncrement = speedIncrement; Direction = Random.insideUnitCircle.normalized; PongManager = ServiceLocator.Get <PongManager>(); }
private void Awake() { if (chatManager == null) { chatManager = GetComponent <Dialogue.ChatManager>(); } if (pongManager == null) { pongManager = GetComponent <PongManager>(); } }
void Awake() { _rb = GetComponent <Rigidbody>(); _meshPaddle = GetComponent <MeshFilter>().mesh; _manager = transform.parent.GetComponent <PongManager>(); _colWall1 = _manager.WallNorth.GetComponent <Collider>(); _colWall2 = _manager.WallSouth.GetComponent <Collider>(); northWallBottom = _colWall1.bounds.center.y - _colWall1.bounds.extents.y; southWallTop = _colWall2.bounds.center.y + _colWall2.bounds.extents.y; }
public override void Enter() { _inputSystem = ServiceLocator.Get <IInputSystem>(); ServiceLocator.Get <GuiManager>().Open(GuiViewType.Match, true); var difficult = (int)FsmManager.GetBlackboardValue("Difficult"); _pongManager = CreatePongManager(); _pongManager.Initialize(ServiceLocator.Get <SettingsManager>().Config.Difficulties[difficult]); _pongManager.SpawnPaddles(); _pongManager.SpawnBall(); SignalBus.Invoke(new GameStartedSignal(_pongManager.Paddle1, _pongManager.Paddle2)); }
private void PongClientForm_Load(object sender, EventArgs e) { RemotingConfiguration.Configure("PongClient.exe.config"); pongManager = new PongManager(); playerID = pongManager.connectPlayer(); playerSide = pongManager.getPlayerSide(playerID); coords = pongManager.getRoomCoords(playerID); this.ClientSize = new Size(RoomInfo.GAME_WIDTH, RoomInfo.GAME_HEIGHT); gameClock = new Timer(); gameClock.Interval = TIMER_INTERVAL; gameClock.Tick += onGameClockTick; gameClock.Start(); }
private void Awake() { instance = this; }
private Rigidbody rigid; //For physics for the ball /*Initialize the variables*/ void Start() { manager = GameObject.Find("GameManager"); pongManager = manager.GetComponent <PongManager>(); rigid = gameObject.GetComponent <Rigidbody>(); }
/*Initialize the variables*/ void Start() { manager = UnityEngine.GameObject.Find("GameManager"); pongManager = manager.GetComponent <PongManager>(); }
private void Start() { _gameManager = GetComponentInParent <PongManager>(); }
private void Start() { instance = this; timer = timeCount; StartCoroutine(StartTimer()); }