Пример #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     col = GetComponent <BoxCollider2D>();
     if (collision.CompareTag("Player") && npc.CanFight && PlayerController.Instance.CanMove)
     {
         npc.EngagePlayer();
     }
 }
Пример #2
0
 /// <summary>
 /// Event method. Can the player start talking to this npc?
 /// </summary>
 private void StartInteraction()
 {
     if (!npc.IsTalking && !npc.IsFighting && npc.CaulculateFacingDirection(PlayerController.Instance.transform.position) == PlayerController.Instance.FacingDirection && !npc.CanFight)
     {
         Debug.Log("chatting");
         PlayerController.Instance.CanMove = false;
         npc.IsTalking     = true;
         npc.CurrentFacing = npc.CaulculateFacingDirection(PlayerController.Instance.transform.position);
         npc.MoveCharacter(false);
     }
     else if (!npc.IsTalking && !npc.IsFighting && npc.CaulculateFacingDirection(PlayerController.Instance.transform.position) == PlayerController.Instance.FacingDirection)
     {
         npc.EngagePlayer();
         npc.CurrentFacing = npc.CaulculateFacingDirection(PlayerController.Instance.transform.position);
         npc.MoveCharacter(false);
     }
 }