public void Awake() { m_initalPos = transform.localPosition; m_initalRot = transform.localRotation; m_whiteBall = transform.parent.GetComponentInChildren <WhiteBall>(); //(WhiteBall) GameObject.FindObjectOfType(typeof(WhiteBall)); GameObject go = new GameObject(); if (go) { m_lr2 = go.AddComponent <LineRenderer>(); m_lr2.material = lineRenderer.material; m_lr2.SetWidth(0.1f, 0.1f); m_lr2.SetColors(Color.yellow, Color.yellow); m_lr2.SetVertexCount(2); m_lr2.gameObject.transform.parent = poolCueGO.transform; m_lr2.transform.localPosition = Vector3.zero; } lineRenderer.SetVertexCount(2); if (lineRenderer && m_whiteBall) { lineRenderer.SetPosition(0, m_whiteBall.transform.position); } //poolCueGO.SetActive(false); }
public virtual void Start() { m_ball = (WhiteBall)GameObject.FindObjectOfType(typeof(WhiteBall)); // m_cue = gameObject.GetComponentInChildren<PoolCue>(); m_myTurn = playerIndex == 0; onPlayerTurn(0); }
void Start() { m_balls = (PoolBall[])GameObject.FindObjectsOfType(typeof(PoolBall)); m_whiteBall = (WhiteBall)GameObject.FindObjectOfType(typeof(WhiteBall)); for (int i = 0; i < m_balls.Length; i++) { m_balls[i].minSpeed = minBallSpeed; } onGameStart(); }
public override void Awake() { base.Awake(); m_balls = (PoolBall[])GameObject.FindObjectsOfType(typeof(PoolBall)); m_pockets = (PocketTrigger[])GameObject.FindObjectsOfType(typeof(PocketTrigger)); m_whiteBall = (WhiteBall)GameObject.FindObjectOfType(typeof(WhiteBall)); m_cue = (PoolCue)GameObject.FindObjectOfType(typeof(PoolCue)); m_myTurn = playerIndex == 0; //onPlayerTurn(0); }
public void onStartGame() { m_whiteBall = transform.parent.GetComponentInChildren <WhiteBall>(); if (m_whiteBall) { transform.parent = m_whiteBall.transform; } transform.localScale = new Vector3(1, 1, 1); transform.localRotation = m_initalRot; transform.localPosition = m_initalPos; if (lineRenderer && m_whiteBall) { lineRenderer.SetPosition(0, m_whiteBall.transform.position); } }
public virtual void changeTurnRPC(bool foul, int turn) { m_foul = foul; m_playerTurn = turn; m_currentPlayer = m_players[m_playerTurn]; m_currentPlayer.foul = m_foul; Vector3 oldBallPos = Vector3.zero; bool hasOldBallpos = false; if (m_whiteBall != null) { hasOldBallpos = true; oldBallPos = m_whiteBall.transform.position; Debug.Log("disable whiteBall" + m_whiteBall.name); m_whiteBall.gameObject.SetActive(false); } m_whiteBall = m_currentPlayer.getWhiteBall(); if (m_whiteBall) { m_whiteBall.gameObject.SetActive(true); if (hasOldBallpos) { m_whiteBall.transform.position = oldBallPos; } Debug.Log("enable whiteBall" + m_whiteBall.name); m_whiteBall.clear(); m_whiteBall.setPoolCue(m_currentPlayer.getCue()); m_whiteBall.foul = m_foul; } PoolKit.BaseGameManager.showTitleCard(m_players[m_playerTurn].playerName + " turn!"); PoolKit.BaseGameManager.playersTurn(m_playerTurn); }
public virtual void Awake() { m_cue = (PoolCue)GameObject.FindObjectOfType(typeof(PoolCue)); m_balls= (PoolBall[])GameObject.FindObjectsOfType(typeof(PoolBall)); m_ball = gameObject.GetComponentInChildren<WhiteBall>(); }
public virtual void Start() { m_ball = (WhiteBall)GameObject.FindObjectOfType(typeof(WhiteBall)); // m_cue = gameObject.GetComponentInChildren<PoolCue>(); m_myTurn = playerIndex==0; onPlayerTurn(0); }
public virtual void Awake() { m_cue = (PoolCue)GameObject.FindObjectOfType(typeof(PoolCue)); m_balls = (PoolBall[])GameObject.FindObjectsOfType(typeof(PoolBall)); m_ball = gameObject.GetComponentInChildren <WhiteBall>(); }
public void Awake() { m_initalPos = transform.localPosition; m_initalRot = transform.localRotation; m_whiteBall =transform.parent.GetComponentInChildren<WhiteBall>(); //(WhiteBall) GameObject.FindObjectOfType(typeof(WhiteBall)); GameObject go = new GameObject(); if(go) { m_lr2 = go.AddComponent<LineRenderer>(); m_lr2.material = lineRenderer.material; m_lr2.SetWidth(0.1f,0.1f); m_lr2.SetColors(Color.yellow,Color.yellow); m_lr2.SetVertexCount(2); m_lr2.gameObject.transform.parent = poolCueGO.transform; m_lr2.transform.localPosition = Vector3.zero; } lineRenderer.SetVertexCount(2); if(lineRenderer && m_whiteBall) lineRenderer.SetPosition(0,m_whiteBall.transform.position); //poolCueGO.SetActive(false); }
public void onStartGame() { m_whiteBall =transform.parent.GetComponentInChildren<WhiteBall>(); if(m_whiteBall) { transform.parent = m_whiteBall.transform; } transform.localScale = new Vector3(1,1,1); transform.localRotation = m_initalRot; transform.localPosition = m_initalPos; if(lineRenderer && m_whiteBall) lineRenderer.SetPosition(0,m_whiteBall.transform.position); }