} // update

    void Patrol()
    {
        currentPatrolTime += Time.deltaTime;
        agent.speed        = walkSpeed;

        #region Walk
        if (agent.velocity.sqrMagnitude > 0)
        {
            enemyAnim.Walk(true);
        }
        else
        {
            enemyAnim.Walk(false);
        }

        #endregion

        if (currentPatrolTime >= patrolTimer)
        {
            currentPatrolTime = 0f;
            SetNewRandomDestination();
        }

        if (Vector3.Distance(transform.position, PlayerPos.position) <= chaseDistance)
        {
            enemyBehaviour = EnemyAttackBehaviour.CHASE;
        }
        else if (Vector3.Distance(transform.position, PlayerPos.position) > chaseDistance)
        {
            enemyBehaviour = EnemyAttackBehaviour.PATROL;
        }
    }
 void AnimateWalk()
 {
     if (charController.velocity.sqrMagnitude != 0)
     {
         playerAnimations.Walk(true);
     }
     else
     {
         playerAnimations.Walk(false);
     }
 }
Beispiel #3
0
    void WalkAnime()
    {
        if (charctrl.velocity.sqrMagnitude != 0f)
        {
            playerAnimations.Walk(true);
        }

        else
        {
            playerAnimations.Walk(false);
        }
    }
    } // rotate

    void AnimateWalk()
    {
        if (charController.velocity.sqrMagnitude != 0f) // if moving
        {
            playerAnimations.Walk(true);
            //Debug.Log("Walking");
        }
        else
        {
            playerAnimations.Walk(false);
        }
    } // animatewalk
Beispiel #5
0
 public void ClickOnInteractive()
 {
     InCar = false;
     animationPoliceman.Walk();
     charMover.GoTo(car.transform.position);
     charMover.OnTargetReached += SitDownInCar;
 }
Beispiel #6
0
    void OnFloorClicked(Vector3 pos)
    {
        if (state == states.CHANGING_LEVEL)
        {
            return;
        }
        if (state == states.ENTERING_DOOR)
        {
            return;
        }
        if (state == states.UI_POPUP)
        {
            return;
        }

        else if (state == states.OPENING_FRUIT_NINJA)
        {
            state = states.PLAYING;
        }

        target.transform.position = pos;
        LookAtTarget(target);
        Vector3 rot = transform.localEulerAngles;

        rot.x = rot.z = 0;
        transform.localEulerAngles = rot;
        moveTo.Init(pos);
        anim.Walk();
    }
 void ChasePlayer()
 {
     navAgent.SetDestination(playerTarget.position);
     navAgent.speed = move_Speed;
     if (navAgent.velocity.sqrMagnitude == 0)
     {
         enemy_Anim.Walk(false);
     }
     else
     {
         enemy_Anim.Walk(true);
     }
     if (Vector3.Distance(transform.position, playerTarget.position) <= attack_Distance)
     {
         enemy_State = EnemyState.ATTACK;
     }
 }
Beispiel #8
0
    private void MovementInput()
    {
        baseMovement.MoveDirection = Input.GetAxis(AxisTags.HORIZONTAL) * screenMovementRight +
                                     Input.GetAxis(AxisTags.VERTICAL) * screenMovementForward;

        if (baseMovement.MoveDirection.sqrMagnitude > 1)
        {
            baseMovement.MoveDirection.Normalize();
        }

        if (Input.GetAxis(AxisTags.HORIZONTAL) != 0f || Input.GetAxis(AxisTags.VERTICAL) != 0f)
        {
            anim.Walk(true);
        }
        else
        {
            anim.Walk(false);
        }
    }
Beispiel #9
0
    void ChasePlayer()
    {
        //follow player to his position
        navagent.SetDestination(Playertarget.position);
        navagent.speed = moveSpeed;

        if (navagent.velocity.sqrMagnitude == 0)
        {
            EnemyAnimations.Walk(false);
        }
        else
        {
            EnemyAnimations.Walk(true);
        }

        if (Vector3.Distance(Playertarget.position, transform.position) <= attackDistance)
        {
            enemystate = EnemyState.ATTACK;
        }
    }
    void ChasePlayer()
    {
        //playerTarget = GameObject.FindGameObjectWithTag(Tags.PLAYER_TAG).transform;
        navAgent.SetDestination(playerTarget.position);
        navAgent.speed = move_speed;

        if (navAgent.velocity.sqrMagnitude == 0)
        {
            enemy_anim.Walk(false);
        }
        else
        {
            enemy_anim.Walk(true);
        }

        if (Vector3.Distance(transform.position, playerTarget.position) <= attack_distance)
        {
            e_state = EnemyState.ATTACK;
        }
    }
Beispiel #11
0
    private void Patrol()
    {
        agent.isStopped = false;
        agent.speed     = walk;

        currentPatrolTimer += Time.deltaTime;

        if (currentPatrolTimer >= patrolTimer)
        {
            currentPatrolTimer = 0f;
            SetNewDestination();
        }


        if (agent.velocity.sqrMagnitude > 0)
        {
            anim.Walk(true);
        }
        else
        {
            anim.Walk(false);
        }

        if (Vector3.Distance(transform.position, targetPos.position) <= chaseDistance)
        {
            enemyAttack = EnemyAttack.CHASE;
        }
        else if (Vector3.Distance(transform.position, targetPos.position) > chaseDistance)
        {
            enemyAttack = EnemyAttack.PATROL;
        }
    }
Beispiel #12
0
    void ChasePlayer()
    {
//        navAgent.destination = playerTarget.transform.position * Time.deltaTime;
        navAgent.SetDestination(playerTarget.transform.position);
        navAgent.speed = move_speed;

        if (navAgent.velocity.sqrMagnitude == 0f)
        {
            //     enemy_state = EnemyState.ATTACK;
            enem_Anim.Walk(false);
        }
        else
        {
            enem_Anim.Walk(true);
        }
        attack_distance = 35f;
        // print(Vector3.Distance(transform.position, playerTarget.transform.position) + "  helooo beasns  " + attack_distance);
        if (Vector3.Distance(transform.position, playerTarget.transform.position) <= attack_distance)
        {
            enemy_state = EnemyState.ATTACK;
        }
    }
Beispiel #13
0
 public void Marian_Walk()
 {
     marian.Walk();
 }