void Update() { //Vector3 curPos = transform.position; //dweller.SyncCellPositionToRealPosition(); //transform.Translate(velocity * Time.deltaTime); //curPos += velocity * Time.deltaTime; transform.position += velocity * Time.deltaTime; GridDweller[] contents = dweller.GetGridWorld().CellContents(dweller.GetCurrentCell()); GridDweller player = contents.FirstOrDefault((gd) => gd.type == DwellerType.Player); //if(dweller.GetGridWorld().IsTypeInCell(dweller.GetCurrentCell(), DwellerType.Player)) { if (player != null) { // TODO: Deduct health. //Debug.Log("HIT THE PLAYER! (TODO: DEDUCT HEALTH)"); player.GetComponentInParent <Health>().TakeDamage(DamageType.Damage, damage); Destroy(gameObject); } }
private CellPosition GetRandomCell() { return(dweller.GetGridWorld().FindRandomCellWithout(DwellerType.Enemy, GridClass.EnemyGrid)); }