Example #1
0
    protected void Awake()
    {
        if (ENGULFED_BURNING_OVERLAY_PREFAB == null)
        {
            ENGULFED_BURNING_OVERLAY_PREFAB = Resources.Load <GameObject>("EngulfedBurningPlayer");
            PARTIAL_BURNING_OVERLAY_PREFAB  = Resources.Load <GameObject>("PartialBurningPlayer");
        }

        if (engulfedBurningOverlay == null)
        {
            engulfedBurningOverlay = GameObject.Instantiate(ENGULFED_BURNING_OVERLAY_PREFAB, transform)
                                     .GetComponent <BurningDirectionalOverlay>();
            engulfedBurningOverlay.enabled = true;
            engulfedBurningOverlay.StopBurning();
            partialBurningOverlay = GameObject.Instantiate(PARTIAL_BURNING_OVERLAY_PREFAB, transform)
                                    .GetComponent <BurningDirectionalOverlay>();
            partialBurningOverlay.enabled = true;
            partialBurningOverlay.StopBurning();
        }

        livingHealthBehaviour = GetComponent <LivingHealthBehaviour>();
        livingHealthBehaviour.OnClientFireStacksChange.AddListener(OnClientFireStacksChange);
        OnClientFireStacksChange(livingHealthBehaviour.FireStacks);


        directional = GetComponent <Directional>();
        directional.OnDirectionChange.AddListener(OnDirectionChange);
        foreach (ClothingItem c in GetComponentsInChildren <ClothingItem>())
        {
            clothes[c.name] = c;
        }
    }
 /// <summary>
 /// Updates whether burning sprites are showing and sets their facing
 /// </summary>
 private void UpdateBurningOverlays(float fireStacks, Orientation currentFacing)
 {
     if (fireStacks <= 0)
     {
         engulfedBurningOverlay.StopBurning();
         partialBurningOverlay.StopBurning();
     }
     else if (fireStacks < FIRE_STACK_ENGULF_THRESHOLD)
     {
         partialBurningOverlay.Burn(currentFacing);
         engulfedBurningOverlay.StopBurning();
     }
     else
     {
         engulfedBurningOverlay.Burn(currentFacing);
         partialBurningOverlay.StopBurning();
     }
 }
Example #3
0
 private void OnClientFireStacksChange(float newStacks)
 {
     if (newStacks <= 0)
     {
         engulfedBurningOverlay.StopBurning();
         partialBurningOverlay.StopBurning();
     }
     else
     {
         if (newStacks >= FIRE_STACK_ENGULF_THRESHOLD)
         {
             engulfedBurningOverlay.Burn(directional.CurrentDirection);
             partialBurningOverlay.StopBurning();
         }
         else
         {
             partialBurningOverlay.Burn(directional.CurrentDirection);
             engulfedBurningOverlay.StopBurning();
         }
     }
 }
    /// <summary>
    /// Instantiate and attach the burning sprite overlays if they don't exist
    /// </summary>
    private void AddBurningOverlayGameObjects()
    {
        if (engulfedBurningOverlay == null)
        {
            engulfedBurningOverlay         = GameObject.Instantiate(ENGULFED_BURNING_OVERLAY_PREFAB, transform).GetComponent <BurningDirectionalOverlay>();
            engulfedBurningOverlay.enabled = true;
            engulfedBurningOverlay.StopBurning();
        }

        if (partialBurningOverlay == null)
        {
            partialBurningOverlay         = GameObject.Instantiate(PARTIAL_BURNING_OVERLAY_PREFAB, transform).GetComponent <BurningDirectionalOverlay>();
            partialBurningOverlay.enabled = true;
            partialBurningOverlay.StopBurning();
        }
    }