public void spawnBallistaObject() { if (!spawned && otc.getPlayStatus()) { if (otc.isPlayerHoster()) { ballistaTag = "BallistaP1"; isHoster = true; } else if (otc.isPlayerResolver()) { ballistaTag = "BallistaP2"; } else { Debug.Log("Player is neither hoster or resolver"); } Pose anchorPose; bool didHit = FindPointOnPlane(out anchorPose); if (didHit) { //it went inside here //parent everything to the worldanchorTransform // when instantiating the transform is global. ASL.ASLHelper.InstanitateASLObject("BallistaObject", Vector3.zero, Quaternion.identity, GetComponent <ASL.ASLObject>().m_Id, GetType().Namespace + GetType().Name, "CreatedBallistaObject"); Debug.Log("Ballista Parent m_id is: " + GetComponent <ASL.ASLObject>().m_Id); spawned = true; matc.setPlayerTag(); } } }
public void setPlayerTag() { if (otc.isPlayerHoster()) { ballistaTag = "BallistaP1"; } else if (otc.isPlayerResolver()) { ballistaTag = "BallistaP2"; } }
//bool isOwn = false; // Start is called before the first frame update void Start() { sb = FindObjectOfType <SpawnBallista>(); mtc = FindObjectOfType <MainATC>(); gs = FindObjectOfType <GameSession>(); otc = FindObjectOfType <OtherController>(); bt = sb.getBallistaTag(); if ((otc.isPlayerHoster() && bt == "BallistaP1") || otc.isPlayerResolver() && bt == "BallistaP2") { //isOwn = true; InvokeRepeating("setPlank", 2.0f, 0.1f); Debug.Log("Plank setting owned"); } }
private void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("plane") && !firstT) { Instantiate(go, other.GetContact(0).point, Quaternion.AngleAxis(90f, Vector3.right)); firstT = true; } if (other.gameObject.CompareTag(oppBT)) { //&& !other.gameObject.CompareTag("Untagged") Destroy(this.gameObject); Debug.Log("Hit!"); if ((otc.isPlayerHoster() && oppBT == "BallistaP2") || (otc.isPlayerResolver() && oppBT == "BallistaP1")) { gs.changeScore(1.0f); } } }