Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
GridCell.cs
Go to the documentation of this file.
2 using UnityEngine;
3 
4 namespace droid.Runtime.Utilities.Misc.Grid {
5  public abstract class GridCell : MonoBehaviour {
6  protected Collider _Col;
7  protected Renderer _Rend;
8  public IntVector3 GridCoordinates { get; set; }
9 
10  public abstract void Setup(string name, Material mat);
11  }
12 
13  public class EmptyCell : GridCell {
14  public override void Setup(string n, Material mat) {
15  this._Rend = this.GetComponent<Renderer>();
16  this._Col = this.GetComponent<Collider>();
17  this.name = n;
18  this._Col.isTrigger = true;
19  this._Rend.enabled = false;
20 
21  //Destroy (this.GetComponent<Renderer> ());
22  //this.GetComponent<Renderer>().material = mat;
23  }
24 
25  public void SetAsGoal(string n, Material mat) {
26  this.name = n;
27  this._Rend.enabled = true;
28  this._Rend.material = mat;
29  this.tag = "Goal";
30  }
31  }
32 
33  public class FilledCell : GridCell {
34  public override void Setup(string n, Material mat) {
35  this.name = n;
36  this.GetComponent<Collider>().isTrigger = false;
37  this.GetComponent<Renderer>().material = mat;
38  this.tag = "Obstruction";
39  }
40  }
41 
42  public class GoalCell : EmptyCell {
43  public override void Setup(string n, Material mat) {
44  this.name = n;
45  this.GetComponent<Collider>().isTrigger = true;
46  this.GetComponent<Renderer>().material = mat;
47  this.tag = "Goal";
48  }
49  }
50 }
override void Setup(string n, Material mat)
Definition: GridCell.cs:43
override void Setup(string n, Material mat)
Definition: GridCell.cs:34
override void Setup(string n, Material mat)
Definition: GridCell.cs:14
void SetAsGoal(string n, Material mat)
Definition: GridCell.cs:25