本文整理汇总了C#中GameData类的典型用法代码示例。如果您正苦于以下问题:C# GameData类的具体用法?C# GameData怎么用?C# GameData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameData类属于命名空间,在下文中一共展示了GameData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MetricUnits
public MetricUnits(Field field, GameData data, int[] randSequence)
{
_field = field;
_gameData = data;
_randSequence = randSequence;
CalcCommonMetrics();
}
示例2: UpdateUI
public void UpdateUI(bool isWin, GameData gameData)
{
score.text = gameData.Score.ToString();
bestScore.text = gameData.HighScore.ToString();
if (isWin)
{
best.SetActive(false);
currentScore.SetActive(false);
WinText.text = "YOU WIN !";
loseImage.enabled = false;
AddFlare();
SoundManager.instance.PlayingSound("Win", 1, Camera.main.transform.position);
}
else
{
SoundManager.instance.PlayingSound ("Lose", 1, Camera.main.transform.position);
}
if(gameData.isHighScore)
{
NewHighScoreText.SetActive(true);
AddFlare();
}
else
{
NewHighScoreText.SetActive(false);
}
}
示例3: CheckStatus
private void CheckStatus()
{
if (this.gameData == null)
{
this.gameData = GameData.instance;
}
if (this.gameGlobalConfig == null)
{
this.gameGlobalConfig = GameConfigs.instance.GlobalConfig;
}
if (this.gameData.UserInfo != null)
{
long[] resourceRecoveryTimes = this.gameData.UserInfo.resourceRecoveryTimes;
long nowServerTime = ServerTimer.GetNowServerTime();
int[] resourceRecoveryTime = this.gameGlobalConfig.resourceRecoveryTime;
int[] resourceRecoveryNum = this.gameGlobalConfig.resourceRecoveryNum;
int[] nums = new int[4];
for (int i = 0; i < 4; i++)
{
if (((resourceRecoveryTimes.Length > i) && (resourceRecoveryTime.Length > i)) && ((resourceRecoveryNum.Length > i) && ((nowServerTime - resourceRecoveryTimes[i]) > resourceRecoveryTime[i])))
{
nums[i] = resourceRecoveryNum[i];
resourceRecoveryTimes[i] = nowServerTime;
}
}
this.gameData.UserInfo.AddAutoProducedResources(nums);
this.OnResourceUpdateEvent(EventArgs.Empty);
}
}
示例4: AdventureLoadout
private void AdventureLoadout(GameData data)
{
data.PlayerData.UnlockedElements[0] = Element.Fire;
data.PlayerData.UnlockedElements[1] = Element.Water;
data.PlayerData.UnlockedElements[2] = Element.Air;
data.PlayerData.UnlockedElements[3] = Element.Earth;
}
示例5: MainForm
public MainForm()
{
InitializeComponent();
this.currentFileData = new GameData(32, 32);
this.currentFileName = null;
this.toolImages = new TextureBrush[7];
for (int i = 0; i < this.toolImages.Length; i++)
{
this.toolImages[i] = new TextureBrush(Image.FromFile("images/" + i + ".png"));
}
this.backgroundImage = new TextureBrush(Image.FromFile("images/checkerboard.png"));
this.selectedTool = 1;
this.graphicsContext = BufferedGraphicsManager.Current;
this.graphics = graphicsContext.Allocate(this.StageEditBoard.CreateGraphics(),
new Rectangle(0, 0, 32 * (int)EDIT_BOARD_SCALING, 32 * (int)EDIT_BOARD_SCALING));
for(int i = 0; i < MainForm.DIRECTIONS.Length; i++)
this.StartDirection.Items.Add(DIRECTIONS[i]);
this.LoadTextureFiles();
this.FileNew(null, null);
}
示例6: Save
public void Save()
{
Debug.Log("Saving");
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/BBgameData1.dat");
GameData data = new GameData();
//assign data fields here
data.gatLevel_damage = Upgrades.instance.gatLevel_damage;
data.gatLevel_fireRate = Upgrades.instance.gatLevel_fireRate;
data.laserLevel_damage = Upgrades.instance.laserLevel_damage;
data.laserLevel_fireRate = Upgrades.instance.laserLevel_fireRate;
data.shotGunLevel_damage = Upgrades.instance.shotGunLevel_damage;
data.shotGunLevel_fireRate = Upgrades.instance.shotGunLevel_fireRate;
data.rocketLevel_damage = Upgrades.instance.rocketLevel_damage;
data.rocketLevel_fireRate = Upgrades.instance.rocketLevel_fireRate;
data.parts = Upgrades.instance.parts;
data.cores = Upgrades.instance.cores;
data.lGun = (int)Equipment.instance.leftGun;
data.rGun = (int)Equipment.instance.rightGun;
data.body = (int)Equipment.instance.body;
data.head = (int)Equipment.instance.head;
bf.Serialize(file, data);
file.Close();
Debug.Log("Saving Done");
}
示例7: Start
// Use this for initialization
void Start()
{
Screen.sleepTimeout = SleepTimeout.NeverSleep;
_gameData = new GameData();
startGameUI.SetActive(true);
endGameUI.SetActive(false);
parachute = GameObject.FindGameObjectWithTag("Parachute");
parachuteController = parachute.GetComponent<ParachuteController>();
player = GameObject.FindGameObjectWithTag("Pilot");
playerController = player.GetComponent<PlayerController>();
playerController.enabled = false;
Physics2D.gravity = new Vector2(0, 0);
originPlayerPosition = player.transform.position;
originParachutePosition = parachute.transform.position;
trankControllers = level.GetComponentsInChildren<TankCotroller>();
playerGameObject.SetActive(false);
SoundManager.instance.startBGM();
// AdMob.requestInterstital( "ca-app-pub-1215085077559999/3564479460", "ca-app-pub-1215085077559999/5180813465" );
// AdMob.init( "ca-app-pub-1215085077559999/3044727060", "ca-app-pub-1215085077559999/6187409461" );
gameUIController.UpdateUI(gameData);
}
示例8: Start
// Use this for initialization
void Start()
{
m_GameData = GameData.Instance;
m_StreamPath = Environment.GetFolderPath (Environment.SpecialFolder.Desktop);
m_StreamPath += "/ImagineNation_Recorded_Data";
if (!Directory.Exists (m_StreamPath))
Directory.CreateDirectory (m_StreamPath);
switch (m_GameData.CurrentSection)
{
case Sections.Sections_1:
m_StreamPath = m_StreamPath + "/SectionOne_PositionData";
break;
case Sections.Sections_2:
m_StreamPath = m_StreamPath + "/SectionTwo_PositionData";
break;
case Sections.Sections_3:
m_StreamPath = m_StreamPath + "/SectionThree_PositionData";
break;
}
CheckIfFileExists ();
}
示例9: StartController
public override void StartController()
{
Application.targetFrameRate = 30;
this.gameData=this.GetManager ().GetComponent<GameData>();
if (this.gameData == null) {
throw new UnassignedReferenceException("Obiekt "+this.GetManager().gameObject.name+" nie ma komponentu GameData");
}
this.guiAssets = this.GetManager ().GetComponent<GuiStatesAssets> ();
if (this.guiAssets == null) {
throw new UnassignedReferenceException("Obiekt "+this.GetManager().gameObject.name+" nie ma komponentu GuiStatesAssets");
}
/**
* zliczamy włączenia gry
*/
this.GetData ().countGames = PlayerPrefs.GetInt ("CountGames");
this.GetData ().countGames++;
PlayerPrefs.SetInt ("CountGames",this.GetData ().countGames);
PlayerPrefs.Save();
adMob = new AdMob ();
adMob.StartBanner ();
this.ChangeState(new States.MainMenuState());
GameCenter.Authenticate();
}
示例10: PlayerGameData
public PlayerGameData(GameData gameData)
{
_gameData = gameData;
PlayerStats = new PlayerStatsGameData();
SlavesOwned = new List<Slave>();
}
示例11: Start
// Use this for initialization
void Start()
{
activeState = new BeginState(this);
Debug.Log("This object is of type: " + activeState);
gameDataRef=GetComponent<GameData>();
}
示例12: Instance
public static GameData Instance ()
{
if (g_Instance == null) {
g_Instance = new GameData ();
}
return g_Instance;
}
示例13: Start
private void Start()
{
this.gameData = GameData.instance;
bool flag = false;
if ((this.activeWhenInEvent == null) || (this.activeWhenInEvent.Length == 0))
{
this.targetObj.SetActive(false);
}
else
{
foreach (MarketingEvents events in this.activeWhenInEvent)
{
if (flag)
{
break;
}
switch (events)
{
case MarketingEvents.BuildEvent:
flag = this.gameData.MarketingDatas.isHasBuildEvent == 1;
break;
case MarketingEvents.PVEExpEvent:
flag = this.gameData.MarketingDatas.isHasPVEEXPEvent == 1;
break;
case MarketingEvents.PVEExploreEvent:
flag = this.gameData.MarketingDatas.isHasPVEExploreEvent == 1;
break;
}
}
}
this.targetObj.SetActive(flag);
}
示例14: Start
void Start()
{
//starts BeginState, sets it to active state
//passes this script - statemanager - to BeginState so it can use it as reference
activeState = new BeginState(this);
gameDataRef = GetComponent<GameData>();
}
示例15: Reinicializar
public void Reinicializar()
{
gameData = new GameData();
//gameData = new GameData(DataCenter.levels[0].jogos[10]);
print(gameData.JogoAtual);
print("Dica 1 " + gameData.Dica(1));
//yield return new WaitForSeconds(2);
ReligarBotao();
imagemJogo.GetComponent<UITexture>().mainTexture = gameData.ImagemDoJogo();
foreach (GameObject b in botoes)
{
b.GetComponentInChildren<UILabel>().text = "";
}
for (int i = 0; i < botoes.Length; i++)
{
botoes[i].GetComponentInChildren<UILabel>().text = gameData.LetrasBotoes[i].ToString();
//botoes[i].GetComponentInChildren<UILabel>().ProcessText();
//print("Texto label: " + i + " " + botoes[i].GetComponentInChildren<UILabel>().text);
botoes[i].GetComponent<ButtonPress>().indice = i;
//yield return new WaitForSeconds(0.1f);
}
for (int i = 0; i < botoes.Length; i++)
{
botoes[i].GetComponentInChildren<UILabel>().text = gameData.LetrasBotoes[i].ToString();
//print("Texto label: " + i + " " + botoes[i].GetComponentInChildren<UILabel>().text);
botoes[i].GetComponent<ButtonPress>().indice = i;
//yield return new WaitForSeconds(0.1f);
}
}