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>
    /// 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();
        }
    }