Beispiel #1
0
    void Update()
    {
        for (int i = 0; i < allCells.Count; i++)
        {
            CellPosition cellPosition = allCells[i];
            PhysicalCell physicalCell = physicalCells[i];

            foreach (DwellerInfo generalTypeInfo in dwellerInfoSet)
            {
                if (gridWorld.IsTypeInCell(cellPosition, generalTypeInfo.type))
                {
                    if (physicalCell.data[generalTypeInfo.type].indicator == null)
                    {
                        physicalCell.data[generalTypeInfo.type].indicator =
                            Instantiate(generalTypeInfo.indicatorPrefab, physicalCell.position);
                        if (physicalCell.data[generalTypeInfo.type].effect != null)
                        {
                            physicalCell.data[generalTypeInfo.type].effect.Play();
                        }
                    }
                }
                else
                {
                    if (physicalCell.data[generalTypeInfo.type].indicator != null)
                    {
                        Destroy(physicalCell.data[generalTypeInfo.type].indicator);
                        physicalCell.data[generalTypeInfo.type].indicator = null;
                        if (physicalCell.data[generalTypeInfo.type].effect != null)
                        {
                            physicalCell.data[generalTypeInfo.type].effect.Stop();
                        }
                    }
                }
            }
        }
    }