// Start is called before the first frame update void Start() { //load game manager gameManager = GameObject.Find("Pixel UI Canvas").GetComponent <GameManager3>(); //load animator animator = GetComponent <Animator>(); //load rigidbody rigidBody = GetComponent <Rigidbody2D>(); //load body size bodySize = GetComponent <BoxCollider2D>().size; //load body center bodyCenter = GetComponent <BoxCollider2D>().offset; }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); boardScript = GetComponent <BoardManager3>(); InitGame(); }
private void Awake() { // Singleton pattern (padrão singleton). if (instance == null) { instance = this; } else if (instance != null) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); // Inicializa nossa lista de inimigos (fazer depois da animação do inimigo). enemies = new List <Enemy3>(); boardManager = GetComponent <BoardManager3>(); InitGame(); }
public void AllTheTests2() { GameManager3 gm = new GameManager3(); // method injection gm.SetChoiceBehavior(new AlwaysScissors()); Assert.AreEqual(GameResult.Win, gm.PlayRound(Choice.Rock).Player1Result); Assert.AreEqual(GameResult.Loss, gm.PlayRound(Choice.Paper).Player1Result); Assert.AreEqual(GameResult.Tie, gm.PlayRound(Choice.Scissors).Player1Result); gm.SetChoiceBehavior(new AlwaysPaper()); Assert.AreEqual(GameResult.Loss, gm.PlayRound(Choice.Rock).Player1Result); Assert.AreEqual(GameResult.Tie, gm.PlayRound(Choice.Paper).Player1Result); Assert.AreEqual(GameResult.Win, gm.PlayRound(Choice.Scissors).Player1Result); gm.SetChoiceBehavior(new AlwaysRock()); Assert.AreEqual(GameResult.Tie, gm.PlayRound(Choice.Rock).Player1Result); Assert.AreEqual(GameResult.Win, gm.PlayRound(Choice.Paper).Player1Result); Assert.AreEqual(GameResult.Loss, gm.PlayRound(Choice.Scissors).Player1Result); }
//Finding GameManager private void Awake() { gameManager = GameObject.FindGameObjectWithTag("GameManager"); gmScript = gameManager.GetComponent <GameManager3>(); first = true; }
void Awake() { manager3 = this; }