Пример #1
0
    public static void Create(GameObject emulatedGamePiecePrefab, string emulatedGamepieceType, Transform parent, Vector2 position)
    {
        GameObject newEmulatedGamePiece = Instantiate(emulatedGamePiecePrefab, parent);

        newEmulatedGamePiece.transform.position = position;
        EmulatedGamePiece newInstance = newEmulatedGamePiece.GetComponent <EmulatedGamePiece>();
        int id = _nextId++;

        GamePiece tmp = new GamePiece(id, id, Vector2.one, position, 0, 0, 0, emulatedGamepieceType);

        newInstance._gamePiece = tmp;
        AtmoTracker.Instance.TriggerAtmoEvent(AtmoEventHandler.AtmoEvents.OnDetect, tmp);

        //set label
        newInstance._label.SetId(newInstance._gamePiece.sessionId);
        newInstance._label.SetSide(newInstance._gamePiece.side);
        newInstance._label.SetType(newInstance._gamePiece.type);
    }
Пример #2
0
    private void CreateEmulatedGamePiece(Vector2 position)
    {
        GameObject chosenGamePiecePrefab;
        string     chosenGamePieceType;

        if (createDice)
        {
            chosenGamePiecePrefab = emulatedDice;
            chosenGamePieceType   = "/dice";
        }
        else
        {
            chosenGamePiecePrefab = emulatedToken;
            chosenGamePieceType   = "/token";
        }

        EmulatedGamePiece.Create(chosenGamePiecePrefab, chosenGamePieceType, transform.GetChild(1), position);
    }