Пример #1
0
    public void Selected()
    {
        if (pieceMove.attacked)
        {
            return;
        }

        if (Input.GetMouseButtonUp(0))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider.tag == "Enemy")
                {
                    CharacterType enemy = hit.collider.GetComponent <CharacterType>();

                    if (enemy.inRange)
                    {
                        Fight(enemy);
                        pieceMove.Attacked();
                    }
                }
            }
        }
    }