Beispiel #1
0
    public void MoveAgent(float[] act)
    {
        // ~2-17 ===============================================================================
        //Vector3 dirToGo = Vector3.zero;
        //Vector3 rotateDir = Vector3.zero;

        //var forwardAxis = (int)act[0];
        //var shootAxis = (int)act[1];

        //switch (forwardAxis)
        //{
        //    case 1:
        //        rotateDir = -transform.up;
        //        break;
        //    case 2:
        //        rotateDir = transform.up;
        //        break;
        //}

        //switch (shootAxis)
        //{
        //    case 1:
        //        myWeaponCtrl.Fire();
        //        break;
        //}

        //playerRb.AddForce(dirToGo * moveSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);
        //transform.Rotate(rotateDir, Time.fixedDeltaTime * turnSpeed);

        // 2-17~ ===============================================================================
        Vector3 dirToGo   = Vector3.zero;
        Vector3 rotateDir = Vector3.zero;

        var shootAxis = (int)act[0];

        switch (shootAxis)
        {
        case 1:
            myWeaponCtrl.Fire();
            break;
        }

        //playerRb.AddForce(dirToGo * moveSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);
        //transform.Rotate(rotateDir, Time.fixedDeltaTime * turnSpeed);
    }
Beispiel #2
0
    public void MoveAgent(float[] act)
    {
        // 2-17~ ===============================================================================
        Vector3 dirToGo   = Vector3.zero;
        Vector3 rotateDir = Vector3.zero;

        var shootAxis = (int)act[0];

        isFire = false;

        switch (shootAxis)
        {
        case 1:
            myWeaponCtrl.Fire();
            isFire = true;
            break;
        }
    }
Beispiel #3
0
    public void MoveAgent(float[] act)
    {
        Vector3 dirToGo   = Vector3.zero;
        Vector3 rotateDir = Vector3.zero;


        if (!isHealing)
        {
            var forwardAxis = (int)act[0];
            var rotateAxis  = (int)act[1];
            var shootAxis   = (int)act[2];
            switch (forwardAxis)
            {
            case 1:
                dirToGo = transform.forward;
                break;

            case 2:
                dirToGo = -transform.forward;
                break;
            }

            switch (rotateAxis)
            {
            case 1:
                rotateDir = -transform.up;
                break;

            case 2:
                rotateDir = transform.up;
                break;
            }

            switch (shootAxis)
            {
            case 1:
                myWeaponCtrl.Fire();
                break;
            }

            agentRb.AddForce(dirToGo * moveSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);
            transform.Rotate(rotateDir, Time.fixedDeltaTime * turnSpeed);
        }
    }