コード例 #1
0
 // 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;
 }
コード例 #2
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
     boardScript = GetComponent <BoardManager3>();
     InitGame();
 }
コード例 #3
0
    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();
    }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: GOScript3.cs プロジェクト: Erlendgje/FoxHunt
 //Finding GameManager
 private void Awake()
 {
     gameManager = GameObject.FindGameObjectWithTag("GameManager");
     gmScript    = gameManager.GetComponent <GameManager3>();
     first       = true;
 }
コード例 #6
0
 void Awake()
 {
     manager3 = this;
 }