// ************* // // ** Trigger ** // // ************* // void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Personnage") { if (col.gameObject.GetComponent <PersoData>().persoCase != thisCase) { TransparencyBehaviour.CheckTransparency(col.gameObject, 1f); personnageData = col.gameObject.GetComponent <PersoData>(); casePathfinding = PathfindingCase.NonWalkable; col.gameObject.GetComponent <PersoData>().persoCase = thisCase; TransparencyBehaviour.CheckTransparency(col.gameObject, 0.5f); } } if (col.tag == "Ballon") { if (col.gameObject.GetComponent <BallonData> ().ballonCase != thisCase) { TransparencyBehaviour.CheckTransparency(col.gameObject, 1f); ballon = col.gameObject.GetComponent <BallonData>(); casePathfinding = PathfindingCase.NonWalkable; col.gameObject.GetComponent <BallonData>().ballonCase = thisCase; TransparencyBehaviour.CheckTransparency(col.gameObject, 0.5f); col.gameObject.GetComponent <BallonData>().xCoord = xCoord; col.gameObject.GetComponent <BallonData>().yCoord = yCoord; } if (winCase != Player.Neutral) { StartCoroutine(UIManager.Instance.ScoreChange(winCase)); } } }
void OnTriggerExit2D(Collider2D col) { if (col.tag == "Personnage" && col.gameObject.GetComponent <BoxCollider2D>().enabled == true && GetComponent <PolygonCollider2D>().enabled == true) { personnageData = null; casePathfinding = PathfindingCase.Walkable; ChangeColor(Statut.None, Statut.isSelected); ChangeColor(Statut.None, Statut.isAllyPerso); } if (col.tag == "Ballon" && col.gameObject.GetComponent <BoxCollider2D>().enabled == true && GetComponent <PolygonCollider2D>().enabled == true) { TransparencyBehaviour.CheckTransparency(col.gameObject, 1f); ballon = null; casePathfinding = PathfindingCase.Walkable; ChangeColor(Statut.None, Statut.canShot); } }
void Awake() { Instance = this; }