Exemplo n.º 1
0
    void AIBehavior()
    {
        //If target is spotted...
        if (targetDetected)
        {
            if (movementAI != null)
            {
                if (!targetInShootingRange || !targetCanBeSeen)
                {
                    movementAI.NavigateTo(targetRef.position);
                }
                else
                {
                    movementAI.EndNavigation();
                }
            }

            if (targetInLineOfSight)
            {
                this.equipment.OnActivate();
            }

            if (targetCanBeSeen && targetInShootingRange)
            {
                Quaternion q = Quaternion.LookRotation(targetRef.position - centerTransform.position);

                Quaternion rot = Quaternion.Slerp(centerTransform.rotation, q, this.turnSpeed * Time.deltaTime);

                this.direction = new Vector3(0, rot.eulerAngles.y, 0);
                centerTransform.eulerAngles = new Vector3(rot.eulerAngles.x, centerTransform.eulerAngles.y, rot.eulerAngles.z);
            }
        }
    }
Exemplo n.º 2
0
    void AIBehavior()
    {
        //If target is spotted...
        if (targetDetected)
        {
            if (movementAI != null)
            {
                if (!targetInShootingRange || !targetCanBeSeen)
                {
                    movementAI.NavigateTo(targetRef.position);
                }
                else
                {
                    movementAI.EndNavigation();
                }

                if (targetInLineOfSight)
                {
                    this.equipment.OnActivate();
                }
            }

            if (targetCanBeSeen && targetInShootingRange)
            {
                Quaternion q = Quaternion.LookRotation(targetRef.position - centerTransform.position);

                centerTransform.rotation = Quaternion.Slerp(centerTransform.rotation, q, 5 * Time.deltaTime);
            }
        }
    }
Exemplo n.º 3
0
    void AIBehavior()
    {
        //If target is spotted...
        if (targetDetected)
        {
            if (movementAI != null)
            {
                if (!targetCanBeSeen || !commitT)
                {
                    movementAI.NavigateTo(targetRef.position);
                }
                else
                {
                    movementAI.EndNavigation();
                }
            }

            if (commitT)
            {
                Death();
            }
        }
    }