public void OpenDoor() { if (this.Portal != null) { this.Portal.open = true; } this.Open = true; this.Timer = 0f; this.UpdateLabel(); if (this.HidingSpot) { UnityEngine.Object.Destroy(this.HideCollider.GetComponent <BoxCollider>()); } this.CheckDirection(); if (this.BucketSet) { this.Bucket.GetComponent <Rigidbody>().isKinematic = false; this.Bucket.GetComponent <Rigidbody>().useGravity = true; this.Bucket.UpdateAppearance = true; this.Bucket.Prompt.enabled = true; this.Bucket.Full = false; this.Bucket.Fly = true; this.Prompt.HideButton[0] = false; this.Prompt.HideButton[1] = true; this.Prompt.Label[1].text = " Set Trap"; this.Prompt.enabled = true; this.BucketSet = false; this.Bucket = null; } }
void OnTriggerEnter2D(Collider2D other) { BucketScript bucket = other.GetComponent <BucketScript>(); //Debug.Log("Collision: " + other.name); if (bucket != null) { //TODO bucket.Fill(); } }
private void ThrowWater() { if (bucket == null) { bucket = GameObject.FindObjectOfType <BucketScript>(); } if (bucket == null) { Debug.LogError("Bucket not found"); } else { bucket.Throw(); } }
// Update is called once per frame void Update() { if (reset) { reset = false; foreach (Transform child in transform) { //Debug.Log(positions[child.name]); child.position = (Vector3)positions[child.name]; child.rotation = (Quaternion)rotations[child.name]; BucketScript childBucket = child.GetComponent <BucketScript>(); if (childBucket != null) { childBucket.reset(); } } } }
private void Update() { if (this.Prompt.DistanceSqr <= 1f) { if (Vector3.Distance(this.Yandere.transform.position, base.transform.position) < 2f) { if (!this.Near) { this.TopicCheck(); this.Yandere.Location.Label.text = this.RoomName; this.Yandere.Location.Show = true; this.Near = true; } if (this.Prompt.Circle[0].fillAmount == 0f) { this.Prompt.Circle[0].fillAmount = 1f; if (!this.Open) { this.OpenDoor(); } else { this.CloseDoor(); } } if (this.Double && this.Swinging && this.Prompt.Circle[1].fillAmount == 0f) { this.Prompt.Circle[1].fillAmount = 1f; if (!this.BucketSet) { if (SchemeGlobals.GetSchemeStage(1) == 2) { SchemeGlobals.SetSchemeStage(1, 3); this.Yandere.PauseScreen.Schemes.UpdateInstructions(); } this.Bucket = this.Yandere.PickUp.Bucket; this.Yandere.EmptyHands(); this.Bucket.transform.parent = base.transform; this.Bucket.transform.localEulerAngles = new Vector3(0f, 0f, 0f); this.Bucket.Trap = true; this.Bucket.Prompt.Hide(); this.Bucket.Prompt.enabled = false; this.CheckDirection(); if (this.North) { this.Bucket.transform.localPosition = new Vector3(0f, 2.25f, 0.2975f); } else { this.Bucket.transform.localPosition = new Vector3(0f, 2.25f, -0.2975f); } this.Bucket.GetComponent <Rigidbody>().isKinematic = true; this.Bucket.GetComponent <Rigidbody>().useGravity = false; if (this.Open) { this.DoorColliders[0].isTrigger = true; this.DoorColliders[1].isTrigger = true; } this.Prompt.Label[1].text = " Remove Bucket"; this.Prompt.HideButton[0] = true; this.CanSetBucket = false; this.BucketSet = true; this.Open = false; this.Timer = 0f; } else { this.Yandere.EmptyHands(); this.Bucket.PickUp.BePickedUp(); this.Prompt.HideButton[0] = false; this.Prompt.Label[1].text = " Set Trap"; this.BucketSet = false; this.Timer = 0f; } } } } else if (this.Near) { this.Yandere.Location.Show = false; this.Near = false; } if (this.Timer < this.TimeLimit) { this.Timer += Time.deltaTime; if (this.Timer >= this.TimeLimit) { this.DoorColliders[0].isTrigger = false; if (this.DoorColliders[1] != null) { this.DoorColliders[1].isTrigger = false; } if (this.Portal != null) { this.Portal.open = this.Open; } } if (this.BucketSet) { for (int i = 0; i < this.Doors.Length; i++) { Transform transform = this.Doors[i]; transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, Mathf.Lerp(transform.localPosition.z, this.OriginX[i] + (this.North ? this.ShiftSouth : this.ShiftNorth), Time.deltaTime * 3.6f)); this.Rotation = Mathf.Lerp(this.Rotation, this.North ? (-this.TrapSwing) : this.TrapSwing, Time.deltaTime * 3.6f); transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, (i == 0) ? this.Rotation : (-this.Rotation), transform.localEulerAngles.z); } } else if (!this.Open) { for (int j = 0; j < this.Doors.Length; j++) { Transform transform2 = this.Doors[j]; if (!this.Swinging) { transform2.localPosition = new Vector3(Mathf.Lerp(transform2.localPosition.x, this.ClosedPositions[j], Time.deltaTime * 3.6f), transform2.localPosition.y, transform2.localPosition.z); } else { this.Rotation = Mathf.Lerp(this.Rotation, 0f, Time.deltaTime * 3.6f); transform2.localPosition = new Vector3(transform2.localPosition.x, transform2.localPosition.y, Mathf.Lerp(transform2.localPosition.z, this.OriginX[j], Time.deltaTime * 3.6f)); transform2.localEulerAngles = new Vector3(transform2.localEulerAngles.x, (j == 0) ? this.Rotation : (-this.Rotation), transform2.localEulerAngles.z); } } } else { for (int k = 0; k < this.Doors.Length; k++) { Transform transform3 = this.Doors[k]; if (!this.Swinging) { transform3.localPosition = new Vector3(Mathf.Lerp(transform3.localPosition.x, this.OpenPositions[k], Time.deltaTime * 3.6f), transform3.localPosition.y, transform3.localPosition.z); } else { transform3.localPosition = new Vector3(transform3.localPosition.x, transform3.localPosition.y, Mathf.Lerp(transform3.localPosition.z, this.OriginX[k] + (this.North ? this.ShiftNorth : this.ShiftSouth), Time.deltaTime * 3.6f)); this.Rotation = Mathf.Lerp(this.Rotation, this.North ? this.Swing : (-this.Swing), Time.deltaTime * 3.6f); transform3.localEulerAngles = new Vector3(transform3.localEulerAngles.x, (k == 0) ? this.Rotation : (-this.Rotation), transform3.localEulerAngles.z); } } } } else if (this.Locked) { if (this.Prompt.Circle[0].fillAmount < 1f) { this.Prompt.Label[0].text = " Locked"; this.Prompt.Circle[0].fillAmount = 1f; } if (this.Yandere.Inventory.LockPick) { this.Prompt.HideButton[2] = false; if (this.Prompt.Circle[2].fillAmount == 0f) { this.Prompt.Yandere.Inventory.LockPick = false; this.Prompt.HideButton[2] = true; this.Locked = false; } } else if (!this.Prompt.HideButton[2]) { this.Prompt.HideButton[2] = true; } } if (!this.NoTrap && this.Swinging && this.Double) { if (this.Yandere.PickUp != null) { if (this.Yandere.PickUp.Bucket != null) { if (this.Yandere.PickUp.GetComponent <BucketScript>().Full) { if (this.Bucket == null) { this.Prompt.HideButton[1] = false; this.CanSetBucket = true; } } else if (this.CanSetBucket) { this.Prompt.HideButton[1] = true; this.CanSetBucket = false; } } else if (this.CanSetBucket) { this.Prompt.HideButton[1] = true; this.CanSetBucket = false; } } else if (this.CanSetBucket) { this.Prompt.HideButton[1] = true; this.CanSetBucket = false; } } if (this.BucketSet && this.Bucket.Gasoline && this.StudentManager.Students[this.StudentManager.RivalID] != null && this.StudentManager.Students[this.StudentManager.RivalID].Follower != null && this.StudentManager.Students[this.StudentManager.RivalID].Follower.CurrentAction == StudentActionType.Follow && Vector3.Distance(base.transform.position, this.StudentManager.Students[this.StudentManager.RivalID].transform.position) < 10f) { this.Yandere.Subtitle.UpdateLabel(SubtitleType.GasWarning, 1, 5f); this.StudentManager.Students[this.StudentManager.RivalID].GasWarned = true; } }