// Start is called before the first frame update
 void Start()
 {
     if (piecesManager == null)
     {
         piecesManager = GetComponent <PiecesManager>();
     }
 }
Example #2
0
    public static PiecesManager Create()
    {
        GameObject gameObject = new GameObject();

        gameObject.name = "PiecesHolder";
        PiecesManager piecesManager = gameObject.AddComponent <PiecesManager>();

        piecesManager._piecesCount = piecesManager._piecesList.Capacity;
        piecesManager.piecePrefab  = Resources.Load <Piece>("Prefabs/Square");
        piecesManager.AddComponents(piecesManager._piecesCount);
        return(piecesManager);
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        gameManager   = FindObjectOfType <GameManager>();
        piecesManager = FindObjectOfType <PiecesManager>();
        GameObject parent = GameObject.Find("Pieces");

        if (parent)
        {
            transform.SetParent(parent.transform);
        }

        piecesManager.registerPiece(this);
    }
Example #4
0
        void Awake()
        {
            // Debug.Log("Awake");
            fieldManager  = transform.Find("FieldManager").GetComponent <FieldManager>();
            piecesManager = transform.Find("PiecesManager").GetComponent <PiecesManager>();
            cp            = transform.Find("CP").GetComponent <PlayerBase>();
            humanPlayer   = transform.Find("HumanPlayer").GetComponent <PlayerBase>();

            cp.SetPlayerKind(PlayerKind.CP);
            humanPlayer.SetPlayerKind(PlayerKind.HumanPlayer);

            if (cp == null)
            {
                Debug.Log("null");
            }
        }
    public static LoadLevelFromJson Create()
    {
        GameObject gameObject = new GameObject();

        gameObject.name = "JsonLoader";
        LoadLevelFromJson jsonLoader = gameObject.AddComponent <LoadLevelFromJson>();

        jsonLoader._levelLoader = new LevelLoader(jsonLoader._level);
        //GameManager.GetInstance().backgroundManager = jsonLoader._backgroundManager = BackGroundManager.Create();
        GameManager.GetInstance().piecesManager = jsonLoader._piecesManager = PiecesManager.Create();
        jsonLoader._levelLoader       = new LevelLoader(jsonLoader._level);
        jsonLoader.cursorPrefab       = Resources.Load <Cursor>("Prefabs/Cursor");
        jsonLoader._cameraCalculation = new CameraCalculation();
        jsonLoader.cursorPrefab       = Instantiate(jsonLoader.cursorPrefab, Vector2.zero, Quaternion.identity);
        GameManager.GetInstance().cursorObject = jsonLoader.cursorPrefab.gameObject;
        jsonLoader.cursorPrefab.gameObject.SetActive(false);
        return(jsonLoader);
    }
Example #6
0
    // Use this for initialization
    void Start()
    {
        spawner       = FindObjectOfType <PieceSpawner>();
        playBoard     = FindObjectOfType <Board>();
        piecesManager = FindObjectOfType <PiecesManager>();

        board         = new bool[40, 40];
        board[20, 20] = true;
        board[19, 20] = true;
        board[20, 19] = true;
        board[19, 19] = true;
        for (int i = 0; i <= 9; i++)
        {
            for (int j = 0; j <= 9; j++)
            {
                board[j, 30 + i]      = true;
                board[j, i]           = true;
                board[39 - j, 30 + i] = true;
                board[39 - j, i]      = true;
            }
        }
    }
Example #7
0
 //FieldManager,PiecesManagerを置き換える
 public void SetManager(FieldManager fieldManager, PiecesManager piecesManager)
 {
     this.fieldManager  = fieldManager;
     this.piecesManager = piecesManager;
 }
        //privateメソッド

        //オブジェクトの初期セッティング
        private void Init()
        {
            fieldManager  = transform.Find("FieldManager").GetComponent <FieldManager>();
            piecesManager = transform.Find("PiecesManager").GetComponent <PiecesManager>();
            SetPlayers();
        }