コード例 #1
0
    public void Initialize()
    {
        weatherItems = new List <GameObject>();
        ForecastType[] weathers = WeatherQueue.GetWeatherArray();
        GameObject     newGo;

        for (int i = 0; i < weathers.Length; i++)
        {
            switch (weathers[i])
            {
            case ForecastType.Water:
                newGo = Instantiate(rainWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup);
                break;

            case ForecastType.Sun:
                newGo = Instantiate(sunWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup);
                break;

            case ForecastType.Lightning:
                newGo = Instantiate(lightningWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup);
                break;

            default:
                newGo = Instantiate(noWeatherImgPrefab, weatherGroup.position, Quaternion.identity, weatherGroup);
                break;
            }
            newGo.SetActive(true);
            weatherItems.Add(newGo);
        }
        // Debug.Log("Initialized Weather Queue Panel");
    }
コード例 #2
0
ファイル: WeatherQueue.cs プロジェクト: swanijam/PlantGame
 private void Awake()
 {
     if (instance != null)
     {
         GameObject.DestroyImmediate(instance.gameObject);
         Debug.LogError("additional weatherqueue found. deleting the older one");
     }
     instance = this;
     // Debug.Log("defined instance");
 }