public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP > 0)
     {
         flashRed.FlashSlugStyle();
         audioManager.PlaySound(0);
         EventManager.TriggerEvent(GlobalEvents.PointsEarned, 100);
         return;
     }
     else if (!dead)
     {
         dead           = true;
         gameObject.tag = "World";
         animator.SetTrigger("explode");
         CancelInvoke();
         audioManager.PlaySound(3);
         float  startTime           = Time.time;
         float  duration            = 0.7f;
         Bounds boundsForExplosions = collider.bounds;
         timeUtils.RepeatEvery(0.045f, () => {
             // Visual
             Animator anim           = SimpleAnimatorPool.GetPooledAnimator(explosion);
             anim.transform.position = RandomPosWithin(boundsForExplosions);
             anim.Play("1");
             if (Time.time > startTime + duration)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         });
     }
 }
Exemple #2
0
 public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP > 1)
     {
         flashRed.FlashSlugStyle();
         EventManager.TriggerEvent(GlobalEvents.PointsEarned, 100);
         audioManager.PlaySound(0);
     }
     else
     {
         Die();
     }
 }
 private void HippieOfferItem()
 {
     if (!itemOffered)
     {
         animManager.PlayGiftAnim(EndOfHippieSalutAnim);
         audioManager.PlaySound(0);
     }
     itemOffered = true;
 }
Exemple #4
0
    public void Execute(string victimTag, Vector3 unused, Vector3 unused2)
    {
        if (attackSwitch)
        {
            anim.SetTrigger("knife2");
            audioManager.PlaySound(4);
        }
        else
        {
            anim.SetTrigger("knife");
            audioManager.PlaySound(5);
        }
        attackSwitch = !attackSwitch;

        knife.CastAOE(victimTag, transform.position);
        EventManager.TriggerEvent(GlobalEvents.KnifeUsed);
        timeUtils.TimeDelay(0.3f, () => { anim.SetBool("knifeing", false); });
    }
Exemple #5
0
    private void BadaBoom()
    {
        GameObject  projectileGameObject = projectilePool.GetPooledObject();
        IProjectile projectile           = projectileGameObject.GetComponent <IProjectile>();
        SlugPhysics projPhysic           = projectileGameObject.GetComponent <SlugPhysics>();

        projectileGameObject.transform.position = projectileInitialPos.position;
        projectile.Launch("Player");
        projPhysic.SetVelocityX(transform.right.x * 0.4f);
        audioManager.PlaySound(2);
    }
    public void Execute(string victimTag, Vector3 unused, Vector3 unused2)
    {
        anim.runtimeAnimatorController = attackAnimatorController;
        anim.SetTrigger("fire");
        GameObject bulletGameObject = bullettPool.GetPooledObject();

        bulletGameObject.transform.position = GetProjPosInit();
        bulletGameObject.transform.right    = movementManager.lookingDirection;
        IProjectile bullet = bulletGameObject.GetComponentInChildren <IProjectile>();

        bullet.Launch(victimTag);
        audioManager.PlaySound(0);
        EventManager.TriggerEvent(GlobalEvents.GunUsed, 0);
    }
Exemple #7
0
 public void OnDamageReceived(ProjectileProperties projectileProp, int newHP)
 {
     if (newHP > 0)
     {
         return;
     }
     else
     {
         animManager.PlayDeathAnimation(projectileProp, DeathAnimCB);
         movementManager.StopMoving();
         inputManager.enabled = false;
         gameObject.layer     = 2;
         if (projectileProp.type == ProjectileType.Grenade)
         {
             physic.SetVelocityY(3);
             physic.SetVelocityX(-transform.right.x / 3);
         }
         else if (projectileProp.type == ProjectileType.Knife)
         {
             EventManager.TriggerEvent(GlobalEvents.PlayerStabbed);
         }
         audioManager.PlaySound(2);
     }
 }
Exemple #8
0
 void PlayMainMusic()
 {
     music = soundManager.PlaySound(0);
 }
Exemple #9
0
 public override void OnDead(ProjectileProperties proj)
 {
     animator.SetTrigger("death");
     audioManager.PlaySound(0);
     brain.Pause();
 }