/* No sharks for now * private void OnTriggerStay(Collider other) * { * if (other.tag == "sharkWaters" && !pathScript.running) * { * Debug.Log("In Shark Waters"); * InitiateSelfDestruct(); * } * } */ private void InitiateSelfDestruct() { myTeam.boatList.Remove(gameObject); myTeam.UpdateBoatCount(); Destroy(myBoatPlan); //GameObject boatExplosion = Realtime.Instantiate(prefabName: "Boat Explosion", ownedByClient: true, preventOwnershipTakeover: true, useInstance: app.realtime); //boatExplosion.transform.position = new Vector3(transform.position.x, boatExplosion.transform.position.y, transform.position.z); Realtime.Destroy(gameObject); }
private void OnTriggerEnter(Collider other) { if (other.tag == "island") { Realtime.Destroy(gameObject); running = false; runPosition = 0; points.Clear(); //_globalTurnSync.NextTurn((int)boatColor); } }
private void OnDestroy() { NetworkSyncManager.OnNetworkTurnUpdate -= PrepairTeamForTurn; if (personalTimer != null) { Realtime.Destroy(personalTimer); } teamPlacard.SetActive(false); if (realtimeView.isOwnedLocallyInHierarchy) { app.gameRefController.UpdateGameStartStatus(); } }
// Update is called once per frame void Update() { currentDuration -= Time.deltaTime; clipNumber = (currentDuration / turnDuration); int testShaderID = testShader.FindPropertyIndex("_AlphaClip"); Debug.Log("Shader ID : " + testShaderID); timerRenderer.material.SetFloat(propertyIDTest, clipNumber); if (currentDuration < 0) { //globalTurnSync.NextTurn((int)boatColor); Realtime.Destroy(gameObject); } }
void InstantiateTimer() { if (globalTurnSync.currentSyncedTurn == 0 && (int)boatColor == 0) { personalTimer = Realtime.Instantiate(prefabName: "YellowTimer", ownedByClient: true, preventOwnershipTakeover: true, useInstance: _realtime); } else if (globalTurnSync.currentSyncedTurn == 1 && (int)boatColor == 1) { personalTimer = Realtime.Instantiate(prefabName: "RedTimer", ownedByClient: true, preventOwnershipTakeover: true, useInstance: _realtime); } else { if (personalTimer != null) { Realtime.Destroy(personalTimer); } } }
private void InstantiateTimer() { if (app.networkSyncManager.currentSyncedTurn == 0 && (int)teamData.teamColor == 0) { personalTimer = Realtime.Instantiate(prefabName: "YellowTimer", ownedByClient: true, preventOwnershipTakeover: true, useInstance: realtime); } else if (app.networkSyncManager.currentSyncedTurn == 1 && (int)teamData.teamColor == 1) { personalTimer = Realtime.Instantiate(prefabName: "RedTimer", ownedByClient: true, preventOwnershipTakeover: true, useInstance: realtime); } else { if (personalTimer != null) { Realtime.Destroy(personalTimer); } } }
public void BoatOnTriggerEnter(GameObject hitObject, String hitTag) { if (realtimeView.isOwnedLocallyInHierarchy) { if (hitTag == "sand") { if (!beached) { //anchorIcon.SetActive(true); beached = true; //timeOut = 0; plan.running = false; InitiateNextPlayerTurn(); runPosition = 0; myBoatPlan.transform.position = transform.position; } } if (hitTag == "glacier") { InitiateNextPlayerTurn(); InitiateSelfDestruct(); } if (hitTag == "bomb" && !plan.running) { InitiateSelfDestruct(); } if (hitTag == "minePickup") { Realtime.Destroy(hitObject); myTeam.totalMines++; myTeam.UpdateMineCountDisplay(); } if (hitTag == "mine") { InitiateSelfDestruct(); Realtime.Destroy(hitObject); } } }
private void CheckToPlacePickup() { Debug.Log("the current turn count is" + currentTurn); if (app.realtime.clientID == 0) { if (currentTurn == nextPickupTurn) { int randomSpot = Random.Range(0, spawnPositions.Length); placedPickup = Realtime.Instantiate(prefabName: "Mine Pickup", ownedByClient: true, preventOwnershipTakeover: true, useInstance: app.realtime); placedPickup.GetComponent <RealtimeTransform>().RequestOwnership(); placedPickup.transform.position = spawnPositions[randomSpot]; nextPickupTurn += turnsBetweenPickups; pickupExpiration = currentTurn + pickupDuration; } if (currentTurn == pickupExpiration) { Realtime.Destroy(placedPickup); } } }
// Update is called once per frame private void SelfDestruct() { Realtime.Destroy(gameObject); }