private void OnTriggerEnter2D(Collider2D collision) { LiquidDrop drop = collision.GetComponent <LiquidDrop>(); if (collision.tag == "Drop" && drop != null) { onDropEnter.Invoke(drop); } }
public void SpawnDrop(SOLiquid lqData) { LiquidDrop clone1 = Instantiate(dropModel.gameObject).GetComponent <LiquidDrop>(); clone1.data = lqData; dropTextureRend.material.SetColor("_Color", lqData.topColor); clone1.transform.position = dropHolder.transform.position + Vector3.right * Random.Range(-dropSpawnDelta, dropSpawnDelta); clone1.transform.SetParent(dropHolder); clone1.gameObject.SetActive(true); }
public void OnDropEnterLiquid(LiquidDrop drop) { if (lastLiquidFragment == null || drop.data != lastLiquidFragment.data) { CreateLiquidFragment(drop.data); IncreaseLiquidAmount(incAmountPerDrop); } else { IncreaseLiquidAmount(incAmountPerDrop); } Destroy(drop.gameObject); }