void detection() {
Collider[] hitsColliders = Physics.OverlapSphere(transform.position, _radius);
// If Player is in a small area
Collider match = System.Array.Find(hitsColliders, (col) => col.gameObject.name == "Perso");
if(match)
{
if(match.transform.GetComponent<Hero>().getMedium() != null)
{
ArrayList molecules= match.transform.GetComponent<Hero>().getMedium().getMolecules();
foreach(Molecule m in molecules)
{
//If player has the Green Fluorescence with a sufficient concentration :: the mine appears
if (m.getName() == _targetMolecule && m.getConcentration() > _concentrationTreshold)
{
if(!_isNear)
{
iTween.ScaleTo(this.gameObject, _optionsIn);
//iTween.FadeTo(transform.FindChild("Mine Light Collider").gameObject, _optionsIn);
//TweenAlpha.Begin(transform.FindChild("Mine Light Collider").gameObject,1f,1f);
_isNear = true;
}
}
else if(m.getName() == _targetMolecule && m.getConcentration() < _concentrationTreshold)
{
iTween.ScaleTo (this.gameObject, _optionsOut);
//iTween.FadeTo (transform.FindChild("Mine Light Collider").gameObject, _optionsOut);
//TweenAlpha.Begin(transform.FindChild("Mine Light Collider").gameObject,1f,0f);
_isNear = false;
}
}
}
}
else
{
iTween.ScaleTo (this.gameObject, _optionsOut);
//iTween.FadeTo (transform.FindChild("Mine Light Collider").gameObject, _optionsOut);
//TweenAlpha.Begin(transform.FindChild("Mine Light Collider").gameObject,1f,0f);
_isNear = false;
}
}
public void stopAnimation() {