Exemple #1
0
    public bool SearchForTarget(int mode)
    {
        // Motion-Sensing Mode
        if (mode == 0)
        {
            if (playerOldPos != playerCurrPos)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }

        // Seachlight Mode
        else
        {
            Vector3 vecToPlayer = playerCurrPos - bc.rb.position;
            float   dp          = Vector3.Dot(DirectionUtil.DirToVector(bc.facing), vecToPlayer.normalized);
            float   angle       = Mathf.Acos(dp);
            int     walllayer   = 9; // fill in with the layer # of anything that obstructs enemy vision

            if (angle <= bc.fieldOfView)
            {
                if (!Physics.Raycast(bc.rb.position, vecToPlayer, vecToPlayer.magnitude, (1 << walllayer)))
                {
                    return(true);
                }
            }
            return(false);
        }
    }
Exemple #2
0
    public Attacking(BossController mybc)
    {
        bc     = mybc;
        player = GameObject.FindGameObjectWithTag("Player");
        facing = DirectionUtil.DirToVector(bc.facing);
//		facing = (player.transform.position - bc.gameObject.transform.position).normalized;
        facing.y       = 0;
        attackDuration = 0.5f;
        attackTimer    = 0;
        numHitboxes    = activateHitboxMoments.Length;
        hitboxes       = new GameObject[numHitboxes];
        damage         = 30;
    }