Exemplo n.º 1
0
    public virtual void TakeDamage(float Damage, DamagerInflicter.WeaponTypes WeaponType = DamagerInflicter.WeaponTypes.Undefined)
    {
        //check invincibility, resistances and stuff
        if (true)
        {
            BloodSpatterSpawner.SpawnSmall(transform.position);


            Health -= Damage;

            if (UseSpriteManager)
            {
                spriteManager.TemporaryColor(new Color(1, 0, 0), 0.5f);
            }

            if (IsPlayer)
            {
                ScreenFx.InjuryScreen();
            }

            if (Health <= 0)
            {
                Die(WeaponType);

                BloodSpatterSpawner.SpawnPool(transform.position);
            }
        }
    }
Exemplo n.º 2
0
 public void ini(Entity.team Team, float Damage, float Lifespan, bool SpawnFxOnTargetInsteadOfSource = false, float DelayBetweenHits = 1, float BecomeActiveAfterSeconds = 0, DamagerInflicter.WeaponTypes WeaponType = DamagerInflicter.WeaponTypes.Undefined)
 {
     this.Team     = Team;
     this.Damage   = Damage;
     this.Lifespan = Lifespan;
     this.SpawnFxOnTargetInsteadOfSource = SpawnFxOnTargetInsteadOfSource;
     this.DelayBetweenHits         = DelayBetweenHits;
     this.BecomeActiveAfterSeconds = BecomeActiveAfterSeconds;
     this.WeaponType = WeaponType;
 }
Exemplo n.º 3
0
    public virtual void Die(DamagerInflicter.WeaponTypes WeaponType = DamagerInflicter.WeaponTypes.Undefined)
    {
        DeathAnimation da = GetComponent <DeathAnimation>();

        if (da != null)
        {
            da.Spawn(transform.position);
        }

        if (IsPlayer)
        {
            ScreenFx.DeathScreen(WeaponType);

            //as other scripts often reference player, destroying him would cause issues, so im just moving him away from any danger, hopefully
            //if id just kept him where he "dies", enemies would still attack him which would mess with cursor
            transform.position = new Vector3(NavTestStatic.MapWidth - 1, NavTestStatic.MapHeight - 1, 0);
        }
        else
        {
            Destroy(this.gameObject);
        }
    }