예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if ((transform.position - player.transform.position).magnitude < VISIONRADIUS && looking == true)
     {
         RaycastHit2D hit = Physics2D.Raycast(eyes.transform.position, (player.transform.GetChild(5).position - eyes.transform.position).normalized, Mathf.Infinity, ~(1 << LayerMask.NameToLayer("Enemy")));
         Debug.DrawLine(player.transform.GetChild(5).position, eyes.transform.position);
         Debug.DrawLine(transform.position, Vector2.up, Color.blue);
         Debug.DrawLine(player.transform.position, Vector2.up, Color.red);
         Debug.Log(hit.collider);
         if (hit.collider.gameObject.tag.Equals("Player"))
         {
             Debug.Log("Player seen, attacking");
             looking = false;
             GameManager.instance.AddEnemyAttack(new CombatBean(attack, HelperScripts.Clone(GameManager.instance.player.transform.position), HelperScripts.Clone(transform.position), gameObject.GetComponent <AttackMoves>()));
         }
     }
     if (walking)
     {
         rb.velocity = new Vector2(speed, rb.velocity.y);
     }
 }
예제 #2
0
 void Parry()
 {
     GameManager.instance.AddPlayerAttack(new CombatBean(CombatBean.Attacks.parry, HelperScripts.Clone(MouseWorldPoint()), HelperScripts.Clone(this.transform.position), GetComponent <AttackMoves>()));
 }