Beispiel #1
0
    public bool TakeHeatShot = false; // Is it the head?

    #endregion Fields

    #region Methods

    /// Use this for recive damage local and sync for all other
    public void GetDamage(float t_damage, string t_from, string t_weapon,Vector3 t_direction,int weapon_ID = 0)
    {
        float m_TotalDamage = t_damage + multiplier;

        bl_OnDamageInfo e = new bl_OnDamageInfo();
        e.mDamage = m_TotalDamage;
        e.mDirection = t_direction;
        e.mWeapon = t_weapon;
        e.mHeatShot = TakeHeatShot;
        e.mWeaponID = weapon_ID;
        e.mFrom = t_from;

        if (HealtScript != null)
            HealtScript.GetDamage(e);
    }
Beispiel #2
0
    public bool TakeHeatShot = false; // Is it the head?

    /// Use this for recive damage local and sync for all other
    public void GetDamage(float t_damage, string t_from, string t_weapon, Vector3 t_direction, int weapon_ID = 0)
    {
        float m_TotalDamage = t_damage + multiplier;

        bl_OnDamageInfo e = new bl_OnDamageInfo();

        e.mDamage    = m_TotalDamage;
        e.mDirection = t_direction;
        e.mWeapon    = t_weapon;
        e.mHeatShot  = TakeHeatShot;
        e.mWeaponID  = weapon_ID;
        e.mFrom      = t_from;

        if (HealtScript != null)
        {
            HealtScript.GetDamage(e);
        }
    }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 void Attack()
 {
     if (Time.time > attackTime)
     {
         bl_PlayerDamageManager pdm = Target.root.GetComponent <bl_PlayerDamageManager>();
         if (pdm != null)
         {
             bl_OnDamageInfo di = new bl_OnDamageInfo();
             di.mActor     = null;
             di.mDamage    = Damage;
             di.mDirection = this.transform.position;
             di.mFrom      = "AI";
             pdm.GetDamage(di);
             attackTime = Time.time + AttackRate;
             Debug.Log("Send Damage!");
         }
         else
         {
             Debug.Log("Can't found pdm in: " + Target.gameObject.name);
         }
     }
 }
Beispiel #4
0
    /// applying impact damage from the explosion to enemies
    private void ApplyDamage()
    {
        List<PhotonPlayer> playersInRange = this.GetPlayersInRange();
        foreach (PhotonPlayer player in playersInRange)
        {
            GameObject p = FindPhotonPlayer(player);
            if (p != null)
            {
                bl_PlayerDamageManager pdm = p.transform.root.GetComponent<bl_PlayerDamageManager>();
                bl_OnDamageInfo odi = new bl_OnDamageInfo();
                odi.mDamage = CalculatePlayerDamage(player);
                odi.mDirection = this.transform.position;
                odi.mFrom = PhotonNetwork.player.name;
                odi.mHeatShot = false;
                odi.mWeapon = WeaponName;
                odi.mWeaponID = WeaponID;
                odi.mActor = PhotonNetwork.player;

                pdm.GetDamage(odi);
            }
            else
                Debug.LogError("This Player "+player.name+ " is not found");
        }
    }
 /// Suicide player
 public void Suicide()
 {
     if (localPlayer && bl_GameManager.isAlive)
     {
         bl_OnDamageInfo e = new bl_OnDamageInfo();
         e.mDamage = 500;
         e.mFrom = base.LocalName;
         e.mDirection = transform.position;
         e.mHeatShot = false;
         e.mWeaponID = 5;
         GetDamage(e);
     }
 }
    /// <summary>
    /// Call this to make a new damage to the player
    /// </summary>
    /// <param name="t_damage">damage</param>
    /// <param name="t_from">name from player attaker</param>
    /// <param name="t_weapon">weapon when send damage</param>
    /// <param name="t_direction">direction of attacker</param>
    //public void GetDamage (float t_damage,string t_from,string t_weapon,Vector3 t_direction,bool isHeatShot,int weapon_ID)
    public void GetDamage(bl_OnDamageInfo e)
    {
        if (!DamageEnabled)
            return;

        Debug.Log(" I been hit by " + e.mFrom + " for " + e.mDamage + " damage");
        if (health > 0)
            photonView.RPC("SyncDamage", PhotonTargets.AllBuffered, e.mDamage, e.mFrom, e.mWeapon, e.mDirection, e.mHeatShot, e.mWeaponID, PhotonNetwork.player);
    }
Beispiel #7
0
 public static void eDamage(bl_OnDamageInfo e)
 {
     if (OnDamage != null)
         OnDamage(e);
 }