private void Start() { if (river == null) { river = (RiverController)GameObject.FindGameObjectWithTag("River").GetComponent <RiverController>(); } }
private void Start() { body = GetComponent <Rigidbody>(); river = RiverController.instance; if (body == null || river == null) { this.enabled = false; } }
protected virtual void Initialize() { body = GetComponent <Rigidbody>(); river = RiverController.instance; if (river == null) { river = (RiverController)GameObject.FindGameObjectWithTag("River").GetComponent <RiverController>(); } if (body == null || river == null) { this.enabled = false; } }
public Api_River_Test() { this._mockLogger = new Mock <ILogger <RiverController> >(); this.riverController = new RiverController(_mockLogger.Object); }
private void Start() { minimumSpeed = SpeedValueManager.GetSpeedValues()[0].riverSpeed; if (instance != null) { Debug.LogWarning("Multiple RiverControllers Detected"); } instance = this; bool allWorking = true; if (GameObject.FindGameObjectWithTag("Player")) { if (observedObjects.Contains(GameObject.FindGameObjectWithTag("Player").GetComponent <FloatingObject>()) == false) { observedObjects.Add(GameObject.FindGameObjectWithTag("Player").GetComponent <FloatingObject>()); } } redo: for (int i = 0; i < observedObjects.Count; i++) { if (observedObjects[i] == null) { observedObjects.RemoveAt(i); goto redo; } } if (allWorking) { GameObject pool = GameObject.Find("EffectsPool"); if (pool != null) { effectsPool = pool.transform; } else { effectsPool = new GameObject("EffectsPool").transform; } BuildMesh(); for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).GetComponent <MeshFilter>().mesh = mesh; } /* * if(gameObject.GetComponent<MeshCollider>() == null) * gameObject.AddComponent<MeshCollider>(); * gameObject.GetComponent<MeshCollider>().sharedMesh = mesh; */ if (endTransform != null) { endTransform.position = riverAsset.nodes[riverAsset.nodes.Length - 1].centerVector; } } else { Debug.LogError("Oh No! Something is wrong, dont worry. I stoped the game so you can fix it in ease."); if (Application.isEditor) { Debug.DebugBreak(); } } }
// Start is called before the first frame update void Start() { float windowWidth = (float)(Screen.width * 3) / (float)(Screen.height * 4); transform.localPosition = new Vector3(2.7f * windowWidth, 1.35f, 4); //Debug.Log(transform.localPosition); if (boatIcon == null) { Debug.LogWarning("BoatIcon Missing!"); } linemap = GetComponent <LineRenderer>(); if (linemap == null) { linemap = gameObject.AddComponent <LineRenderer>(); Debug.LogWarning("LineRenderer Missing!\nAdded temp"); } river = RiverController.instance; iconPos = Vector3.zero; start = river.riverAsset.nodes[0].centerVector; if (endpoint) { end = river.riverAsset.GetNodeFromPosition(river.transform.position, endpoint.transform.position).centerVector; } levelStartX = 0; levelEndX = 10000; int i = 0; foreach (RiverNode node in river.riverAsset.nodes) { if (node.centerVector.x > levelStartX) { levelStartX = node.centerVector.x; } if (node.centerVector.x < levelEndX) { levelEndX = node.centerVector.x; } if (node.centerVector.z > levelStartZ) { levelStartZ = node.centerVector.z; } if (node.centerVector.z < levelEndZ) { levelEndZ = node.centerVector.z; } i++; if (node.centerVector == end) { break; } } if (i > river.riverAsset.nodes.Length - 1) { i = river.riverAsset.nodes.Length - 1; } amountOfNodes = i; mapStartZ = 2; mapEndZ = -2.5f; mapStartX = 3; mapEndX = -1; mapLength = mapEndZ - mapStartZ; mapWidth = mapEndX - mapStartX; levelLength = (levelStartZ - levelEndZ) / mapLength; levelWidth = (levelStartX - levelEndX) / mapWidth; linemap.positionCount = i; for (int o = 0; o < i; o++) { Vector3 linepos = river.riverAsset.nodes[o].centerVector; linepos.x /= levelWidth; linepos.z /= levelLength; linepos.x += mapStartX; linepos.z += mapStartZ; linepos.y = 0; linemap.SetPosition(o, linepos); //Debug.Log(linepos.z); } dotRenderer.positionCount = 14; dotRenderer.SetPosition(0, linemap.GetPosition(0)); int dot = 1; for (int o = 8; o < i; o += 8) { dotRenderer.SetPosition(dot, linemap.GetPosition(o)); dot++; } iconPos = linemap.GetPosition(0); endPointGraphic.transform.localPosition = linemap.GetPosition(i - 1) + new Vector3(0, 0.02f, 0); linemap.enabled = false; }