Exemple #1
0
    public static PlayerPiece[] placePiece(PlayerStatus[] aStatus, Vector2 aStartPosition)
    {
        //コマの入れ物
        MyBehaviour tPieceContainer = MyBehaviour.create <MyBehaviour>();

        tPieceContainer.name      = "piceContainer";
        tPieceContainer.positionZ = -5;

        PlayerPiece[] tPieces = new PlayerPiece[aStatus.Length];
        PlayerPiece   tPrefab = Resources.Load <PlayerPiece>("prefab/game/playerPiece");

        for (int i = 0; i < aStatus.Length; i++)
        {
            PlayerPiece tPiece = GameObject.Instantiate <PlayerPiece>(tPrefab);
            tPiece.mRenderer.sprite = Animal.getPieceImage(aStatus[i].mAnimalName);
            tPiece.mRenderer.color  = PlayerStatus.playerColor[i];
            tPiece.setRelativePosition(PlayerPiece.mPieceRelativePosition[i]);
            tPiece.position2D = aStartPosition;
            tPiece.transform.SetParent(tPieceContainer.transform, false);
            tPieces[i] = tPiece;
        }
        return(tPieces);
    }