public List <EnemyInfo> GetEnemyInfos() { var enemyInfos = new List <EnemyInfo>(); foreach (var zombie in zombies) { Color color = Color.white; if (IsAttacking(zombie)) { color = Color.red; } else if (IsInvestigating(zombie)) { color = Color.yellow; } else if (IsSleeping(zombie)) { color = Color.gray; } EnemyIcon iconNum = GetIconNum(zombie); enemyInfos.Add( new EnemyInfo( zombie.gameObject, color, asset.GetSpirit(iconNum))); } return(enemyInfos); }
IEnumerator InstantiateEnemyIcon(EnemyIcon enemyBoat, int index, int totalSquads, float spawnTime) { yield return(new WaitForSeconds(spawnTime)); GameObject clone = null; switch (enemyBoat) { case EnemyIcon.Rock: clone = Instantiate(RockSilhouette); break; case EnemyIcon.Paper: clone = Instantiate(PaperSilhouette); break; case EnemyIcon.Scissor: clone = Instantiate(ScissorSilhouette); break; default: clone = Instantiate(RockSilhouette); break; } int currentRow = Mathf.FloorToInt((float)index / (float)columns); int totalRows = Mathf.CeilToInt((float)totalSquads / (float)columns); float startPositionX = 0f; if (currentRow < totalRows - 1) { totalSquads = columns; } else { totalSquads = totalSquads % columns; if (totalSquads == 0) { totalSquads = columns; } } index = index % columns; startPositionX = (totalSquads - 1) * xSpacing / -2f; clone.transform.SetParent(transform, false); clone.transform.localPosition = new Vector3( startPositionX + index * xSpacing, ySpacing * (currentRow + 1f), 0f); clone.transform.localRotation = Quaternion.identity; clone.transform.localScale = Vector3.one * 30f; icons.Add(clone); }
public Sprite GetSpirit(EnemyIcon iconNum) { return(sprites[(int)iconNum]); }