Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public HotZone Add(HotZone value)
        {
            // Use base class to process actual collection operation
            base.List.Add(value as object);

            return(value);
        }
Exemplo n.º 2
0
    void LoopHotZones()
    {
        HotZone next = hotZones[hotZones.Count - 1].next;

        if (next != null)
        {
            hotZones.Add(next);
            LoopHotZones();
        }
    }
Exemplo n.º 3
0
 // -----------------------------------------------------------------------
 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();
         }
     }
 }
Exemplo n.º 4
0
 // -----------------------------------------------------------------------
 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();
         }
     }
 }
Exemplo n.º 5
0
    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;
            }
        }
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
        // =======================================================================
        // 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);
        }
Exemplo n.º 8
0
 public int IndexOf(HotZone value)
 {
     // Find the 0 based index of the requested entry
     return(base.List.IndexOf(value));
 }
Exemplo n.º 9
0
 public bool Contains(HotZone value)
 {
     // Use base class to process actual collection operation
     return(base.List.Contains(value as object));
 }
Exemplo n.º 10
0
 public void Insert(int index, HotZone value)
 {
     // Use base class to process actual collection operation
     base.List.Insert(index, value as object);
 }
Exemplo n.º 11
0
 public void Remove(HotZone value)
 {
     // Use base class to process actual collection operation
     base.List.Remove(value as object);
 }
Exemplo n.º 12
0
    float ToHotZoneDistance(HotZone hotZone)
    {
        Vector3 playerPosition = target.position - hotZone.transform.position;

        return(playerPosition.magnitude);
    }
Exemplo n.º 13
0
    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;
            }
        }
    }