public HotZone Add(HotZone value) { // Use base class to process actual collection operation base.List.Add(value as object); return(value); }
void LoopHotZones() { HotZone next = hotZones[hotZones.Count - 1].next; if (next != null) { hotZones.Add(next); LoopHotZones(); } }
// ----------------------------------------------------------------------- void HotZoneGUI() { HotZone[] hotZones = new HotZone[myHotZones.Values.Count]; myHotZones.Values.CopyTo(hotZones, 0); foreach (var hz in hotZones) { if (hz.OnGUI != null) { hz.OnGUI(); } } }
// ----------------------------------------------------------------------- void HotZoneMouseOver(Vector2 p) { HotZone[] hotZones = new HotZone[myHotZones.Values.Count]; myHotZones.Values.CopyTo(hotZones, 0); foreach (var hz in hotZones) { if (hz.Area.Contains(p) && hz.OnMouseOver != null) { hz.OnMouseOver(); } } }
void CheckHotZones() { for (int i = hotZones.Count - 1; i >= 0; --i) { HotZone current = hotZones[i]; float targetHotZoneDistance = ToHotZoneDistance(current); if (targetHotZoneDistance < current.maxRadius) { ReplaceForHotZone(current); return; } } }
void ReplaceForHotZone(HotZone hotZone) { float distance = ToHotZoneDistance(hotZone); float ratio = 1; if (distance < hotZone.minRadius) { ratio = 1; } else { ratio = 1 - (distance - hotZone.minRadius) / hotZone.shift; } hopePosition = Vector3.Lerp(hopePosition, hotZone.cameraPosition.position, ratio); lookPosition = Vector3.Lerp(lookPosition, hotZone.cameraLookAt.position, ratio); }
// ======================================================================= // HotZone Processing // ----------------------------------------------------------------------- bool HotZoneMouseClick(Vector2 p, iCS_PickInfo pickInfo) { bool isUsed = false; HotZone[] hotZones = new HotZone[myHotZones.Values.Count]; myHotZones.Values.CopyTo(hotZones, 0); foreach (var hz in hotZones) { if (hz.IsForeground == true || (pickInfo == null || pickInfo.PickedObject.IsBehaviour)) { if (hz.Area.Contains(p) && hz.OnMouseClick != null) { hz.OnMouseClick(); isUsed = true; } } } return(isUsed); }
public int IndexOf(HotZone value) { // Find the 0 based index of the requested entry return(base.List.IndexOf(value)); }
public bool Contains(HotZone value) { // Use base class to process actual collection operation return(base.List.Contains(value as object)); }
public void Insert(int index, HotZone value) { // Use base class to process actual collection operation base.List.Insert(index, value as object); }
public void Remove(HotZone value) { // Use base class to process actual collection operation base.List.Remove(value as object); }
float ToHotZoneDistance(HotZone hotZone) { Vector3 playerPosition = target.position - hotZone.transform.position; return(playerPosition.magnitude); }
void OnTriggerEnter2D(Collider2D other) { switch (other.gameObject.tag) { case "CloudZone": insideCloudeZone = true; zone = other.gameObject.GetComponent <CloudZoneController>(); if (zone != null) { if (zone.path != null) { zone.path.Activate(); } } break; case "HealingCloud": other.gameObject.GetComponent <HealingCloudController>().StartRain(); break; case "Drop": if (other.GetComponent <DropZoneController>() != null) { insideDropZone = true; waterCost = other.GetComponent <DropZoneController>().Cost; } break; case "HotZone": HotZone hotZone = other.gameObject.GetComponent <HotZone>(); currentWaterLose = hotZone.WaterLoss; break; case "MagmaZone": SceneManager.LoadScene("GameOver"); break; case "enemy": if (!isHit) { if (transform.position.x <= other.transform.position.x) { m_Rigidbody.AddForce(new Vector2(-1, 1) * knockForce); } else { m_Rigidbody.AddForce(new Vector2(1, 1) * knockForce); } LoseWater(damageTaken); transform.Find("Container").GetComponent <Animator>().SetTrigger("Hit"); isHit = true; StartCoroutine(PreventHit()); } break; default: break; if (other.tag == "DropZone") { insideDropZone = true; waterCost = other.GetComponent <DropZoneController>().Cost; } } if (other.gameObject.tag == "CheckPoint") { CheckPoint checkPoint = other.gameObject.GetComponent <CheckPoint>(); if (!checkPoint.IsChecked) { LevelManager.instance.CheckPoint = checkPoint.Index; checkPoint.IsChecked = true; } } }