Add photon for damage

Options
Hello all i need our help

player local have damage hunger, but player connecte don receive damage help me please add photon view
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using System.Collections.Generic;
using System.Linq.Expressions;
using System;
using System.Linq;
using Devdog.InventorySystem;
using Devdog.InventorySystem.Models;
using Devdog.InventorySystem.UI;
using UnityEngine.Assertions;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class Hunger : Photon.MonoBehaviour 

{
    public CharacterUI characterUI; // Assign in the inspector
    public vp_FPPlayerDamageHandler playerDamageScript;// Assign in the inspector
    public vp_FPPlayerDamageHandler script;// Assign in the inspector
    public vp_PlayerRespawner spawn;
    public float foodDamageAmount;
    public float checkFood = 10;     //How often the script checks the food value. This also is how often the player is damaged when the food is 10 or below
    public float checkFoodTimer = 0;
    private WaitForSeconds waitTime;
    public IInventoryCharacterStat hungerStat;
    

    public void Update()
    {
        hungerStat = characterUI.stats.Get("Default", "Hunger");

        waitTime = new WaitForSeconds(1f); // Create once to avoid GC
        StartCoroutine(DegradeHungerOverTime());
        checkFoodTimer += Time.deltaTime;   // Start Food Timer
    }
    protected IEnumerator DegradeHungerOverTime()
    {
        yield return waitTime;
        // Decrease stamina by 1 every second. This will auto. repaint any UI that displays this stat.
        hungerStat.ChangeCurrentValueRaw(-0.1f);

        if
            (checkFoodTimer >= checkFood && hungerStat.currentValue <= 10) //Check food value has reached 10
        {
            playerDamageScript.Damage(foodDamageAmount);    //Damage Player
             
            if (script.CurrentHealth <= 0) // if check  health 
            {
                script.Die();
                Debug.Log("Die = " + spawn);
                SceneManager.LoadScene("SosSurvival1");
                




            }

        }


    }

}

Comments