Esempio n. 1
0
    private void InitBullet(int i, int j)
    {
        GameObject bulletGameObject = (GameObject)Instantiate(buletPrefab,
                                                              BoardManager.instance.GetCenterNode(_currentSelection.CurrentX, _currentSelection.CurrentY),
                                                              Quaternion.identity);
        Bullet bullet = bulletGameObject.GetComponent <Bullet>();

        if (bullet != null)
        {
            bullet.AtkTarget(BoardManager.instance.BasePieces[i, j], BoardManager.instance.BasePieces[_currentSelection.CurrentX, _currentSelection.CurrentY].Attack);
        }
    }
Esempio n. 2
0
    private void AttackPiece(BasePiece piece, int x, int y)
    {
        var bulletX = BoardManager.instance.GetCenterNode(piece.CurrentX, piece.CurrentY).x;
        var bulletZ = BoardManager.instance.GetCenterNode(piece.CurrentX, piece.CurrentY).z;

        GameObject bulletGameObject = (GameObject)Instantiate(buletPrefab,
                                                              new Vector3(bulletX, 0.5f, bulletZ),
                                                              Quaternion.identity);
        var bulletRenderer = bulletGameObject.GetComponent <Renderer>();

        bulletRenderer.material.color = Color.red;
        Bullet bullet = bulletGameObject.GetComponent <Bullet>();

        if (bullet != null)
        {
            bullet.AtkTarget(BoardManager.instance.BasePieces[x, y],
                             BoardManager.instance.BasePieces[piece.CurrentX, piece.CurrentY].Attack);
        }
    }