public void Init(UnitInfo infoPrefab, int teamID, Transform parent) { transform.parent = parent; this.teamID = teamID; this.info = Instantiate(infoPrefab); this.info.Init(); AbilitesAvalable = new List <bool>(); mover = GetComponent <Mover>(); sight = GetComponentInChildren <Sight>(); visual = GetComponentInChildren <SpriteRenderer>(); AI = Instantiate(info.AI); AI.Init(mover, sight, info); selectedCircle.transform.localScale = (info.size.Value / 32) * .5f * Vector2.one; this.name = info.Name; this.visual.color = info.Color; this.GetComponent <Rigidbody2D>().mass = info.mass.Value; this.GetComponentInChildren <SpriteRenderer>().sprite = info.Sprite; this.GetComponent <CircleCollider2D>().radius = info.size.Value / 200; this.GetComponent <Selectable>().Init(); }
public void Init(Mover mover, Sight sight, UnitInfo info) { this.mover = mover; this.sight = sight; this.info = info; path = new List <Vector3>(); commandsQueue = new Queue <Command>(); }