Exemple #1
0
    public void Use()
    {
        GameObject target = TacticMovement.checkForPlayer(TacticMovement.currentPlayer, 0);

        if (target == null)
        {
            if (Input.GetButtonDown("x"))
            {
            }
        }
        else
        {
            if (Input.GetMouseButtonUp(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))
                {
                    if (hit.collider.tag == "Enemy")
                    {
                        TacticMovement.currentPlayer.transform.LookAt(target.transform);
                        target.GetComponent <EnemyStats>().HP -= (int)(TacticMovement.currentPlayer.GetComponent <BaseStats>().att * 1.5);
                    }
                }
            }
        }
    }
Exemple #2
0
    void checkAttack()
    {
        GameObject target = TacticMovement.checkForPlayer(this.gameObject, 0);

        if (target == null)
        {
            gameObject.GetComponent <TacticMovement>().hadTurn = true;
            gameObject.GetComponent <TacticMovement>().EndTurn();
            state = turnState.CHECKSTATE;
        }
        else
        {
            this.gameObject.transform.LookAt(target.transform);
            target.GetComponent <BaseStats>().HP -= this.gameObject.GetComponent <EnemyStats>().att;
            gameObject.GetComponent <TacticMovement>().hadTurn = true;
            gameObject.GetComponent <TacticMovement>().EndTurn();
            state = turnState.CHECKSTATE;
        }
    }