Beispiel #1
0
    // Here we handle the collision events with another particles, in this example water+lava= water-> gas
    void OnTriggerEnter2D(Collider2D other)
    {
        //if (currentState == STATES.WATER && other.gameObject.tag == "DynamicParticle")
        //{
        //    if (other.collider.GetComponent<DynamicParticle>().currentState == STATES.LAVA)
        //    {
        //        SetState(STATES.GAS);
        //    }
        //}

        //ps.Play();

        /*
         * if (other.gameObject.CompareTag("bullet2") && !isSteaming)
         * {
         *  GameObject psChild = Instantiate(ps);
         *  psChild.transform.position = gameObject.transform.position;
         *  psChild.transform.SetParent(gameObject.transform);
         *  Destroy(gameObject, 7f);
         *
         *  isSteaming = true;
         * }*/
        if (other.tag == "WaterPool")
        {
            managerScript.SetWaterInPool(managerScript.GetWaterInPool() + 1);
            inPool = true;
        }
        if (other.tag != "WaterPool" && other.tag != "WaterDisappear" && other.tag != "WaterPoolCollisionArea" && other.tag != "bullet2")
        {
            destroyObject = true;
        }
    }
Beispiel #2
0
 protected override void OnTriggerEnter2D(Collider2D collision)
 {
     if (!collision.CompareTag("Player"))
     {
         if (collision.gameObject.CompareTag("DynamicParticle"))
         {
             managerScript.SetEvaporatedWater(managerScript.GetEvaporatedWater() + 1);
             DynamicParticle d = collision.gameObject.GetComponent <DynamicParticle>();
             if (d.GetIsInPool() && d.evapLeft > 0 && managerScript.GetWaterInPool() >= managerScript.GetWaterNeededInPool())
             {
                 managerScript.SetEvaporatedWater(managerScript.GetEvaporatedWater() + 1);
                 d.evapLeft -= 1;
             }
         }
         if (collision.gameObject.CompareTag("DynamicParticleL3"))
         {
             Level3DynamicParticleScript d3 = collision.gameObject.GetComponent <Level3DynamicParticleScript>();
             if (d3.isInPool && d3.evapLeft > 0 && managerScript.GetWaterInPool() >= managerScript.GetWaterNeededInPool())
             {
                 managerScript.SetEvaporatedWater(managerScript.GetEvaporatedWater() + 1);
                 d3.evapLeft -= 1;
             }
         }
     }
 }
Beispiel #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (seepingEnabled)
        {
            if (collision.gameObject.name == "SeepingCollider")
            {
                cc.enabled = false;
                bc.enabled = false;
            }
            else if (collision.gameObject.name == "RightPoolBoundary")
            {
                stopMoving  = true;
                rb.velocity = new Vector2(0, 0);
                manager.setWaterInPool1(manager.getWaterInPool1() + 1);
                Destroy(gameObject);
            }
            else if (collision.gameObject.name == "WaterPoolColliderRight")
            {
                manager.setWaterInPool1(manager.getWaterInPool1() + 1);
            }
        }
        else
        {
            if (collision.transform.tag == "bullet2")
            {
                heatEnergyThreshold -= heatEnergyIncrement;
                if (frozen)
                {
                    Destroy(collision.gameObject);
                }
            }
            else if (collision.gameObject.name == "WaterPoolColliderLeft" && !frozen)
            {
                manager.setWaterInPool2(manager.getWaterInPool2() + 1);
                AudioManager.playSplash();
                Destroy(gameObject);
            }
            else if (collision.transform.tag == "FreezeCollider")
            {
                this.transform.GetChild(0).gameObject.SetActive(false);
                sr.enabled = true;
                bc.enabled = true;
                cc.enabled = false;
                this.transform.localScale = new Vector3(1, 1, 1);
                frozen = true;
            }
        }

        if (SceneManager.GetActiveScene().name == "Level 5")
        {
            if (collision.tag == "WaterPool" && !frozen)
            {
                ILevelManagerWater manager5 = GameObject.Find("GameManager").GetComponent <ILevelManagerWater>();
                manager5.SetWaterInPool(manager5.GetWaterInPool() + 1);
                isInPool = true;
                AudioManager.playSplash();
                Destroy(gameObject);
            }
        }
    }
 private void Update()
 {
     if (managerScript.GetWaterInPool() < waterThreshold)
     {
         //  DisableSteam();
     }
 }
Beispiel #5
0
    protected override void Update()
    {
        base.Update();

        waterInPoolBar.BarValue = manager.GetWaterInPool();
        this.transform.GetChild(1).GetComponent <Text>().text = ":" + playerAttributes.GetCurrentWater();
    }
Beispiel #6
0
    protected override void Start()
    {
        base.Start();

        manager = managerObj.GetComponent <ILevelManagerWater>();

        //WaterCount - child 2
        this.transform.GetChild(1).GetComponent <Text>().text = ":" + playerAttributes.waterCollected;

        waterInPoolBar = this.transform.GetChild(4).GetComponent <ProgressBar>();
        setInitialBarValues(waterInPoolBar, manager.GetWaterInPool(), manager.GetWaterNeededInPool());
    }