Esempio n. 1
0
    void FormlessBehavior()
    {
        //print("im a formless enemy character");
        //movement behavior
        Vector2 movementDirection = (movementPathPoints[currentMovementPathPoint].transform.position -
                                     gameObject.transform.position).normalized;

        //print(movementDirection);
        //moving the player
        customCharacterController.Move(movementDirection);

        //gets next movementPathPoints point when player is close to its destination
        if (Vector3.Distance(gameObject.transform.position,
                             movementPathPoints[currentMovementPathPoint].transform.position) < .1f)
        {
            currentMovementPathPoint++;
            if (currentMovementPathPoint >= movementPathPoints.Length)
            {
                currentMovementPathPoint = 0;
            }
        }

        if (!aggressiveCharacter)
        {
            return;
        }
        //attack behavuior
        if (attackCoowdown <= 0)
        {
            int attackDirection = Random.Range(0, attackDirectionPoints.Length);
            customAttackController.Attack(attackDirectionPoints[attackDirection].transform.position, attackType);
            attackCoowdown = intervalBetweenAttacks;
        }
        else
        {
            attackCoowdown -= Time.fixedDeltaTime;
        }
    }
Esempio n. 2
0
 public void UseActiveItem(GameObject itemEffect)
 {
     attackController.Attack(sightPoint.transform.position, itemEffect);        //passar objeto
 }