Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     attackVector = input.OnAttack();
     if (attackVector != null)
     {
         attackTimer = 0.0f;
         OrientWeapon(attackVector.GetValueOrDefault()); // even if we check if attackVector is not null, we have to pass it with a null-safe expression
         if (gameObject.CompareTag("Player") && GetComponentInParent <IAvatar>().GetElement().type == Type.Paper)
         {
             ShootProjectile();
         }
         attachedWeapon.gameObject.SetActive(true);
     }
     else
     {
         if (attackTimer >= attackDuration)
         {
             attachedWeapon.gameObject.SetActive(false);
         }
         else
         {
             attackTimer += Time.deltaTime;
         }
     }
 }