public MovingWallE(GameObject wallE) { Hp = 180; Score = 10; Speed = 3f; StartingPosition = new Vector3(256.665f, 1f, 170.023f); Scale = new Vector3(0.2f, 0.2f, 0.2f); Rotation = Quaternion.Euler(0f, 90f, 0f); CurrentObject = Instantiate(wallE); CurrentObject.transform.position = StartingPosition; CurrentObject.transform.localScale = Scale; CurrentObject.transform.localRotation = Rotation; CurrentObject.GetComponent <Rigidbody>().drag = 0; CurrentObject.GetComponent <Rigidbody>().velocity = new Vector3(0, 0, 0); CurrentObject.GetComponent <Rigidbody>().freezeRotation = true; }
public MovingElephant(GameObject elephant) { Hp = 150; Score = 6; Speed = 4f; StartingPosition = new Vector3(260f, 0.6f, 170.023f); Scale = new Vector3(100f, 100f, 100f); Rotation = Quaternion.Euler(0f, 180f, 0f); CurrentObject = Instantiate(elephant); CurrentObject.transform.position = StartingPosition; CurrentObject.transform.localScale = Scale; CurrentObject.transform.localRotation = Rotation; CurrentObject.GetComponent <Rigidbody>().drag = 0; CurrentObject.GetComponent <Rigidbody>().velocity = new Vector3(0, 0, 0); CurrentObject.GetComponent <Rigidbody>().freezeRotation = true; }
/// <summary> /// Dequeues the next object in the dog's focus queue, then determines /// whether the dog should avoid or seek the object based on type. /// </summary> private void ProcessObject() { isProcessingObject = true; // Break out of process object loop if the focus queue is empty. if (FocusQueue.Count == 0) { isProcessingObject = false; return; } CurrentObject = FocusQueue.Dequeue(); currentObjectCollider = CurrentObject.GetComponent <BoxCollider>(); if (CurrentObject.transform.CompareTag("Obstacle") || CurrentObject.transform.CompareTag("Pole")) { StartCoroutine(AvoidObstacleRoutine()); } else if (CurrentObject.transform.CompareTag("Waste")) { StartCoroutine(SeekWasteRoutine()); } }