private void Update()
    {
        Vector3 InputDirection = Vector3.forward;

        InputDirection.Set(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
        character.Move(InputDirection);


        if (Input.GetKeyDown(KeyCode.Space))
        {
            character.Jump();
        }

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100000, GroundLayer))
            {
                if (hit.collider)
                {
                    character.AttackCommand(hit.point - character.transform.position);
                }
            }
        }
    }
Exemple #2
0
 public override void ActionUpdate(AI_Base brain, Character_Base character)
 {
     base.ActionUpdate(brain, character);
     if (character.canAttack())
     {
         character.AttackCommand(TargetTransform.position - Character.transform.position);
         ActionFinish();
     }
 }
Exemple #3
0
 public override void ActionStart(AI_Mission_Base mission, AI_Base brain, Character_Base character)
 {
     base.ActionStart(mission, brain, character);
     if (character.canAttack())
     {
         character.AttackCommand(TargetTransform.position - Character.transform.position);
         ActionFinish();
     }
 }
 public override void ActionUpdate(AI_Base brain, Character_Base character)
 {
     base.ActionUpdate(brain, character);
     if (character.canAttack())
     {
         GameObject g = FindNearestEnemy();
         if (g != null)
         {
             character.AttackCommand(g.transform.position - Character.transform.position);
         }
     }
     if (FollowTransform != null)
     {
         character.Move(FollowTransform.position - character.transform.position);
     }
     else
     {
         character.Move(Vector3.zero);
     }
 }