Beispiel #1
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        Health           -= Value;
        _timeSinceDamaged = 0.0f;

        return(CheckIfDead());
    }
Beispiel #2
0
    void TakeDamage(EventInfo ei)
    {
        DamageEventInfo dei = (DamageEventInfo)ei;

        if (dei.ObjectHit == hitBox)
        {
            if (health > 0)
            {
                health -= dei.Damage;
            }
            if (health <= 0)
            {
                ActivateBlockade();
            }
        }
        else if (dei.ObjectHit == activeHitbox1 || dei.ObjectHit == activeHitbox2)
        {
            if (activeHealth > 0)
            {
                activeHealth -= dei.Damage;
            }

            if (activeHealth <= 0)
            {
                DeactivateBlockade();
            }
        }
    }
Beispiel #3
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo = null, Controller Instigator = null)
    {
        health -= Value;
        if (health <= 0)
        {
            if (_controller)
            {
                _controller.RequestSpectate();
            }
            Debug.Log(gameObject.name + " was killed by " + Instigator.playerName + " ripripripripripripripriprip");
        }

        string DamageEventString = Source.ActorName + " " + EventInfo.DamageType.verb + " " + this.ActorName + " (" + Value.ToString() + " damage)";

        if (Instigator)
        {
            DamageEventString = Instigator.playerName + " via " + DamageEventString;
        }
        else
        {
            DamageEventString = "The World via " + DamageEventString;
        }
        DAMAGELOG(DamageEventString);


        return(true);
    }
Beispiel #4
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo = null, Controller Instigator = null)
    {
        health -= Value;
        if (health <= 0)
        {
            Source.GetComponentInParent <HeroPawn>().numOfGrenades++;
            IgnoresDamage = true;
            if (_controller)
            {
                _controller.RequestSpectate();
            }
            isDead         = true;
            colbox.enabled = false;
            StartCoroutine(deathAn());
        }

        string DamageEventString = Source.ActorName + " " + EventInfo.DamageType.verb + " " + this.ActorName + " (" + Value.ToString() + " damage)";

        if (Instigator)
        {
            DamageEventString = Instigator.playerName + " via " + DamageEventString;
        }
        else
        {
            DamageEventString = "The World via " + DamageEventString;
        }
        DAMAGELOG(DamageEventString);


        return(true);
    }
Beispiel #5
0
    private void TakeDamage(EventInfo eventInfo)
    {
        Debug.Log("healthbar value before " + playerHealthBar.value);
        DamageEventInfo DamageInfo = (DamageEventInfo)eventInfo;

        playerHealthBar.value -= DamageInfo.damage * 10;
        heathAmount.text       = "Health: " + playerHealthBar.value;
        Debug.Log("healthbar value after " + playerHealthBar.value);
    }
Beispiel #6
0
    /// <summary>
    /// Deals damage to the player.
    /// </summary>
    /// <param name="dmg"> The damage value that will be dealt</param>
    public void GetAttacked(int dmg)
    {
        health -= dmg;
        DamageEventInfo dei = new DamageEventInfo {
            damage = dmg
        };

        EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.Damage, dei);
    }
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        base.ProcessDamage(Source, Value, EventInfo, Instigator);

        if (Value > 0)
        {
            OnDeath();
        }

        return(true);
    }
Beispiel #8
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        HP -= Value;
        LOG(ActorName + " HP: " + HP);

        if (HP <= 0)
        {
            controller.RequestSpectate();
            Destroy(gameObject);
        }

        return(base.ProcessDamage(Source, Value, EventInfo, Instigator));
    }
Beispiel #9
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        // Shields -= Value;
        // LOG(ActorName + " HP: " + Shields);

        //  if (Shields <= 0)
        {
            controller.RequestSpectate();
            //Destroy(gameObject);
        }

        return(base.ProcessDamage(Source, Value, EventInfo, Instigator));
    }
Beispiel #10
0
    /// <summary>
    /// Public Method for Actors to take Damage, unless IgnoresDamage is true
    /// </summary>
    /// <param name="Source">Actor causing the damage (i.e. the bullet)</param>
    /// <param name="Value">How Much Damage Taken</param>
    /// <param name="EventInfo">Optional, Description of the Damage via Damage Event Info, if null Default Event\BaseDamageType used</param>
    /// <param name="Instigator">Optional, Who to Credit Damage (i.e. who shot the bullet), if null World Damage is assumed</param>
    /// <returns>Result of ProcessDamage</returns>
    public virtual bool TakeDamage(Actor Source, float Value, DamageEventInfo EventInfo = null, Controller Instigator = null)
    {
        // If we don't care about damage, just return true and be done!
        if (IgnoresDamage)
        {
            return(true);
        }

        // Validate Event Info given
        if (EventInfo == null)
        {
            EventInfo = new DamageEventInfo();
        }

        return(ProcessDamage(Source, Value, EventInfo, Instigator));
    }
Beispiel #11
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        isHurt              = true;
        body.color          = new Color(1f, 0f, 0f, 1f);
        head.color          = new Color(1f, 0f, 0f, 1f);
        upperArmLeft.color  = new Color(1f, 0f, 0f, 1f);
        upperArmRight.color = new Color(1f, 0f, 0f, 1f);
        upperLegLeft.color  = new Color(1f, 0f, 0f, 1f);
        upperLegRight.color = new Color(1f, 0f, 0f, 1f);
        lowerArmLeft.color  = new Color(1f, 0f, 0f, 1f);
        lowerArmRight.color = new Color(1f, 0f, 0f, 1f);
        lowerLegLeft.color  = new Color(1f, 0f, 0f, 1f);
        lowerLegRight.color = new Color(1f, 0f, 0f, 1f);

        LOG("Took Damage");
        Controller controller = GetController();

        Health = Health - Value;
        Debug.Log(Health);
        if (Health <= 0f)
        {
            isDead       = true;
            rb.velocity  = new Vector2(0f, 0f);
            isPlayerDead = true;
            gameObject.GetComponent <Animator>().SetBool("isHeroDead", true);
            //Destroy(gameObject, 5f);

            Debug.Log(gameObject.name + " has died!");
            IgnoresDamage = true;
            //Game.Self.PlayerDied(this, Source, EventInfo, Instigator);
            //Debug.Log(gameObject.name + " was killed by " + Instigator.playerName + " ripripripripripripripriprip");
        }

        string DamageEventString = Source.ActorName + " " + EventInfo.DamageType.verb + " " + this.ActorName + " (" + Value.ToString() + " damage)";

        if (Instigator)
        {
            DamageEventString = Instigator.playerName + " via " + DamageEventString;
        }
        else
        {
            DamageEventString = "The World via " + DamageEventString;
        }
        DAMAGELOG(DamageEventString);

        return(false);
    }
Beispiel #12
0
    /// <summary>
    /// This is where Damage is processed and applied, Called by take Damage
    /// Protected as this should be only overriden by child actor classes.
    /// Also does basic damage event loggin.
    /// </summary>
    /// <returns>Return False if Dead!</returns>
    protected virtual bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        // Setup for Logging Dammage Information
        string DamageEventString = Source.ActorName + " " + EventInfo.DamageType.verb + " " + this.ActorName + " (" + Value.ToString() + " damage)";

        if (Instigator)
        {
            DamageEventString = Instigator.Name + " via " + DamageEventString;
        }
        else
        {
            DamageEventString = "The World via " + DamageEventString;
        }
        DAMAGELOG(DamageEventString);

        return(true);
    }
Beispiel #13
0
    /// <summary>
    /// Checks if the Player has a torch out, if it has lost it's target and if it is close enough to attack.
    /// Then swaps state depending on what condition is true
    /// </summary>
    public override void Update()
    {
        AIagent.SetDestination(Prey.transform.position);

        if (PlayerHasFire)
        {
            owner.TransitionTo <AlphaFleeState>();
        }
        else if (!PreyLocated)
        {
            owner.TransitionTo <AlphaPatrolState>();
        }
        else if (CheckRemainingDistance(Prey.transform.position, 3f))
        {
            if (Prey.gameObject.tag == "Cow")
            {
                Prey.GetComponent <CowSM>().AttackTheCow((int)Damage);
            }
            else if (Prey.gameObject.tag == "Player")
            {
                Prey.GetComponent <PlayerStateMashine>().GetAttacked((int)Damage);
                DamageEventInfo dei = new DamageEventInfo {
                    damage = Damage
                };
                EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.Damage, dei);
                Debug.Log("Damage is done by wolf, dmg " + Damage);
            }
            if (Prey == null)
            {
                PreyLocated = false;
            }
            owner.TransitionTo <AlphaObserveState>();
        }
        base.Update();

        //check it out

        /*
         * NavMeshPath path =null;
         * NavMesh.CalculatePath(Vector3.zero, Vector3.up, NavMesh.AllAreas, path);
         * path.corners.ToList().ForEach(p => Position);
         */

        setVelocity();
    }
Beispiel #14
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        // Setup for Logging Dammage Information
        string DamageEventString = Source.ActorName + " " + EventInfo.DamageType.verb + " " + this.ActorName + " (" + Value.ToString() + " damage)";

        if (Instigator)
        {
            DamageEventString = Instigator.Name + " via " + DamageEventString;
        }
        else
        {
            DamageEventString = "The World via " + DamageEventString;
        }
        DAMAGELOG(DamageEventString);

        //Applying damage to health


        Health -= Value;

        if (Health <= 0f)
        {
            if (Instigator)
            {
                PWPlayerController PWPC     = ((PWPlayerController)Instigator);
                PWPlayerController PWPCthis = ((PWPlayerController)controller);
                LOG(PWPC.PlayerName + " Killed " + PWPCthis.PlayerName);
            }
            else
            {
                PWPlayerController PWPCthis = ((PWPlayerController)controller);
                LOG("World Killed " + PWPCthis.PlayerName);
            }

            IgnoresDamage = true;

            Game.Self.GetSpectator(controller);
        }



        return(true);
    }
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        Health -= Value;
        LOG(ActorName + " HP: " + Health);

        if (Health <= 0)
        {
            controller.RequestSpectate();
            Destroy(gameObject);
            PWC.Deaths();
        }

        // if(deaths > 3)
        //{
        //add code here
        // }

        return(base.ProcessDamage(Source, Value, EventInfo, Instigator));
    }
Beispiel #16
0
    protected override bool ProcessDamage(Actor Source, float Value, DamageEventInfo EventInfo, Controller Instigator)
    {
        if (currentHealth <= 0)
        {
            IgnoresDamage = true;
        }

        base.ProcessDamage(Source, Value, EventInfo, Instigator);

        currentHealth -= Value;

        if (currentHealth <= 0)
        {
            onDeath();

            return(false);
        }

        Actor tookCrit = Source.GetComponent <BossEyeHitbox>();

        if (tookCrit)
        {
            currentState = new States(stateHitstun);

            currentState();
        }

        tookCrit = Source.GetComponent <BossTopHitbox>();

        if (tookCrit)
        {
            currentState = new States(stateCriticalHitstun);

            currentState();
        }


        return(true);
    }