Exemplo n.º 1
0
    public void SetInfomation(ref GZ_Player player)
    {
        GZ_AudioModule.Instance.Play(0);

        AcquireIndex = player.Index;
        player.TileScore++;
        ArcRenderer.material.SetColor("_Color", player.PColor);
        GZ_GameSystem.Instance.OccupiedTileCount++;
    }
Exemplo n.º 2
0
    public bool SelectTile(ref GZ_Player player)
    {
#if UNITY_EDITOR
        Debug.DrawLine(Vector3.zero, _debugHittedPos, Color.red);
#endif
        RaycastHit hit;
        Ray        ray    = Camera.main.ScreenPointToRay(Input.mousePosition);
        bool       result = false;

        if (Physics.Raycast(ray, out hit))
        {
#if UNITY_EDITOR
            _debugHittedPos = hit.point;
#endif

            //find proper column
            var   tarVec = hit.point - this.transform.position;
            var   dirNum = GZ_Math.GetAngleDir(this.transform.up, tarVec, this.transform.forward);
            float angle  = Mathf.Acos(Vector2.Dot(tarVec.normalized, this.transform.up)) * Mathf.Rad2Deg;

            if (dirNum == 1)
            {
                angle = 360 - angle;
            }

            int matchColumn = (int)(angle / AngleOffset);

            //find Row

            for (int r = 0; r < _tileArray.GetLength(0); r++)
            {
                result = _tileArray[r, matchColumn].CheckDistance(tarVec.magnitude);
                if (result)
                {
                    _tileArray[r, matchColumn].SetInfomation(ref player);
                    return(true);
                }
            }
        }
        return(result);
    }