Revize bde2c350
Přidáno uživatelem Zuzana Káčereková před téměř 4 roky(ů)
Client/Client/Assets/Scripts/Weather/WeatherData.cs | ||
---|---|---|
3 | 3 |
using System.Collections.Generic; |
4 | 4 |
using UnityEngine; |
5 | 5 | |
6 |
/// <summary> |
|
7 |
/// Weather data container |
|
8 |
/// |
|
9 |
/// Author: kacerekz |
|
10 |
/// |
|
11 |
/// </summary> |
|
6 | 12 |
public class WeatherData |
7 | 13 |
{ |
14 |
/// <summary> |
|
15 |
/// Observers to changes in the data |
|
16 |
/// </summary> |
|
8 | 17 |
private List<WeatherObserver> observers = new List<WeatherObserver>(); |
9 | 18 | |
19 |
/// <summary> |
|
20 |
/// Temperature |
|
21 |
/// </summary> |
|
10 | 22 |
public double Temperature { get; private set; } |
23 |
|
|
24 |
/// <summary> |
|
25 |
/// Wind speed |
|
26 |
/// </summary> |
|
11 | 27 |
public double Wind { get; private set; } |
28 |
|
|
29 |
/// <summary> |
|
30 |
/// Rain probability |
|
31 |
/// </summary> |
|
12 | 32 |
public double Rain { get; private set; } |
33 |
|
|
34 |
/// <summary> |
|
35 |
/// Weather condition |
|
36 |
/// </summary> |
|
13 | 37 |
public WeatherConditions Weather { get; private set; } |
14 | 38 | |
39 |
/// <summary> |
|
40 |
/// Value setter |
|
41 |
/// </summary> |
|
42 |
/// <param name="temperature">Temperature to set</param> |
|
43 |
/// <param name="wind">Wind speed to set</param> |
|
44 |
/// <param name="rain">Rain probability to set</param> |
|
45 |
/// <param name="weather">Weather condition to set</param> |
|
15 | 46 |
public void SetValues(double temperature, double wind, double rain, WeatherConditions weather) |
16 | 47 |
{ |
17 | 48 |
Temperature = temperature; |
... | ... | |
25 | 56 |
observer.Notify(this); |
26 | 57 |
} |
27 | 58 | |
59 |
/// <summary> |
|
60 |
/// Registers an observer |
|
61 |
/// </summary> |
|
62 |
/// <param name="observer">A WeatherObserver to register</param> |
|
28 | 63 |
public void RegisterObserver(WeatherObserver observer) |
29 | 64 |
{ |
30 | 65 |
observers.Add(observer); |
Také k dispozici: Unified diff
Cosmetic changes to the project