void Update() { if (!answered) { timeQuestion -= Time.deltaTime; timerBar.fillAmount = timeQuestion / 60.0f; if (timeQuestion >= 30.0f) { timerBar.color = Color.green; } else if (timeQuestion >= 15.0f) { timerBar.color = Color.yellow; } else if (timeQuestion >= 0.0f) { timerBar.color = Color.red; } else { SoundManager.PlayAnswerSound(false); answersNonInteractable(); GameBehaviourScript.SendJugada(QuestionDataScript.getPosition(), "", true, false); StartCoroutine(WaitAndExit(1)); } } }
// Use this for initialization void Start() { if (audioSource == null) { audioSource = GameBehaviourScript.GetInstance().gameObject.GetComponent <AudioSource> (); } }
// public GameObject Vaatteet2; // private Transform vaatteet2Transform; void Awake() { gameBehaviourScript = vaatepeli_hahmo.GetComponent <GameBehaviourScript>(); // vaatteet2Transform = Vaatteet2.GetComponent<Transform>(); initialPosition = transform.position; KokoHahmoTransform = KokoHahmo.GetComponent <Transform>(); }
public void escolheNivel() { lbLoading.gameObject.SetActive(true); //carrega o prooximo nivel //GameBehaviourScript.GetInstance().CarregarNivel("nivel_"+nivel); GameBehaviourScript.GetInstance().CarregarNivel(nivel); }
public float Fitness(GameBehaviourScript game, OptimizationData optimizationData) { float fitness = 0; if (optimizationData.FirstAwayContactWithBallTime < float.MaxValue) { fitness += 150 - optimizationData.FirstAwayContactWithBallTime; } else { foreach (var p in game.Players) { if (p.Team == Team.Away) { fitness -= Vector3.Distance(p.PivotPoint, game.Ball.PivotPoint); } } } if (game.Ball.controllingPlayer == null || game.Ball.controllingPlayer.Team == Team.Home) { fitness -= 50; } return(fitness); }
public void Initialize() { game = GameObject.FindObjectOfType(typeof(GameBehaviourScript)) as GameBehaviourScript; switch (Args.GameMode) { case GameMode.Simple1v1WithoutBall: { new Optimizer1v1WithoutBall().Initialize(); fitnessCounter = new Fitness1v1WithoutBall(); } break; case GameMode.Simple1v1WithBall: { new Optimizer1v1WithBall().Initialize(); fitnessCounter = new FitnessSimple1v1WithBall(); } break; case GameMode.Simple1v1Play: { new Optimizer1v1WithoutBall().Initialize(); fitnessCounter = new FitnessSimple1v1Play(); } break; case GameMode.Simple2v2WithoutBall: { new Optimizer2v2WithoutBall().Initialize(); fitnessCounter = new FitnessSimple2v2Play(); } break; } }
private void AnswerThreeButtonOnClick() { answersNonInteractable(); answered = true; if (QuestionDataScript.getCorrectAnswer() == 2) { string quesito = QuestionDataScript.getCategory(); Debug.Log("GETQUESITO" + QuestionDataScript.getQuesito()); if (QuestionDataScript.getQuesito()) { activateQuesito(quesito); } answerThreeButton.GetComponent <Image>().color = Color.green; SoundManager.PlayAnswerSound(true); addCoin(); GameBehaviourScript.SendJugada(QuestionDataScript.getPosition(), QuestionDataScript.getQuesito() ? quesito : "", false, false); } else { answerThreeButton.GetComponent <Image>().color = Color.red; SoundManager.PlayAnswerSound(false); GameBehaviourScript.SendJugada(QuestionDataScript.getPosition(), "", true, false); } StartCoroutine(WaitAndExit(2)); }
// Use this for initialization void Start() { GameBehaviourScript.GetInstance().Pausar(); tamanho = framesDicas.Length; dicaAtiva = framesDicas [0]; }
public float Fitness(GameBehaviourScript game, OptimizationData optimizationData) { float fitness = 0; fitness -= optimizationData.FinalBallDistanceToHomeGoal; fitness += (game.Score.Goals[Team.Away] - game.Score.Goals[Team.Home]) * 100.0f; return(fitness); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void OnTriggerEnter2D(Collider2D other) { //verifica se apenas o play esta sendo esperado na zona de morte if (apenasOPlayer) { if (other.CompareTag("Player")) { Destroy(other.gameObject); GameBehaviourScript.GetInstance().GameOver(false); } } else { //se atingido por qualquer objeto entao ativa o game over Destroy(other.gameObject); GameBehaviourScript.GetInstance().GameOver(false); } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { //play na particula de goal goal.Play(); //para o cronometro GameBehaviourScript.GetInstance().gameStatus = GameBehaviourScript.GameStatus.PAUSADO; //executa som de goal gameObject.GetComponent <AudioSource>().PlayOneShot(somGoal); //mostra a interface de passou Invoke( "Vitoria", 1f ); Destroy(other.gameObject); } }
public float Fitness(GameBehaviourScript game, OptimizationData optimizationData) { float fitness = 0; fitness -= optimizationData.FinalBallDistanceToHomeGoal; if (optimizationData.AwayCorner) { fitness += 5.0f; } if (game.Score.Goals[Team.Away] > 0) { fitness = 100; } fitness -= game.Clock.TotalSeconds / (Args.Minutes * 60); return(fitness); }
private void CalculaPremio(float tempo) { Debug.Log("Iniciando o calculo do premio"); int estrelas = 1; //Debug.Log (GameObject.FindGameObjectsWithTag ("Brilho").Length); //sempre ativa a primeira estrela brilhos[0].SetActive(true); //se pegou pelomenos um brilho entao ativa a segunda estrela if (GameBehaviourScript.GetInstance().relogio > 0) { brilhos[1].SetActive(true); estrelas++; } //se pegou todos os brilhos entao ganha as 3 estrelas if (GameObject.FindGameObjectsWithTag("Brilho").Length == 0) { estrelas++; brilhos[2].SetActive(true); } GravaEstrelas(estrelas); //calcula os pontos float pontos = tempo * 100; if (estrelas == 3) { pontos += 500; mais500.SetActive(true); } lbResultado.text = pontos.ToString(); GravaRecord(pontos); }
public void Awake() { // PlayerPrefs.DeleteAll (); // PlayerPrefs.SetInt ("nivel", 1); //PlayerPrefs.SetInt ("estrelas_" + Application.loadedLevelName, 0); if (game == null) { game = this; } else { Debug.LogError("Existe mais de uma instancia de GameBehaviourScript"); } //verifica o nivel atual if (PlayerPrefs.GetInt("nivel") == 0) { PlayerPrefs.SetInt("nivel", nivelAtual); } else { nivelAtual = PlayerPrefs.GetInt("nivel"); } }
public void ProximoNivel() { GameBehaviourScript.GetInstance().AvancaNivel(); }
/** * Vai para o menu de seleção de fase */ public void GoToMenu() { lbLoading.gameObject.SetActive(true); GameBehaviourScript.GetInstance().CarregarMenu(); }
void OnTriggerEnter2D(Collider2D other) { Destroy(other.gameObject); GameBehaviourScript.GetInstance().CarregarMenu(); }
// Use this for initialization void Start() { game = GameObject.FindObjectOfType(typeof(GameBehaviourScript)) as GameBehaviourScript; }
/** * Quando o objetivo é atingido **/ private void Vitoria() { // GameBehaviourScript.GetInstance ().LevelUP (nivel); GameBehaviourScript.GetInstance().LevelUP(Application.loadedLevel); GameBehaviourScript.GetInstance().GameOver(true); }
private void GameOver() { GameBehaviourScript.GetInstance().GameOver(false); }
private void Iniciar() { GameBehaviourScript.GetInstance().Play(); gameObject.SetActive(false); }