Example #1
0
    public void Initialize(FightingEntity target, int damage, DamageType damageType)
    {
        // Format based on damage type
        if (damageType == DamageType.HEALING)
        {
            damage            = Mathf.Abs(damage);
            _damageText.color = _healColour;
        }
        else if (damageType == DamageType.MANA_RECOVERY)
        {
            _damageText.color = _manaRecoveryColour;
        }

        // Set position
        FighterPositions uiPositions = target.GetComponent <FighterPositions>();

        if (uiPositions != null)
        {
            _worldPosition = uiPositions.damagePopup.position;
        }
        else
        {
            Debug.LogWarning(target.name + " has no damagePopupLocation");
        }
        _worldToScreen.SetWorldPoint(_worldPosition);

        SetText(damage);
        GameManager.Instance.time.GetController().StartCoroutine(Fade());
    }
Example #2
0
    protected virtual void InstantiateHitEffect(FightingEntity target)
    {
        FighterPositions positions = target.GetComponent <FighterPositions>();

        if (targetHitEffect != null && positions != null)
        {
            GameObject hitEffect = Instantiate(targetHitEffect, positions.damagePopup);
            hitEffect.transform.localScale = target.transform.localScale;
        }
    }
Example #3
0
    public void EndFight(FightResult fightResult, ActionBase action)
    {
        CheckIfAnyEntityDied(fightResult, action);

        // Mooks should broadcast their fights for clarity
        if (!fighter.isEnemy() && !fighter.IsHero())
        {
            // TODO: do in more clean way
            ActionListener actionListener = fighter.GetComponent <ActionListener>();
            actionListener.EchoMessage(fightResult.GetAnnouncerMessage());
        }

        onFightEnd(fightResult);
    }
Example #4
0
    protected virtual void InstantiateParticleEffect(FightingEntity user, FightingEntity target)
    {
        FighterPositions userPositions   = user.GetComponent <FighterPositions>();
        FighterPositions targetPositions = target.GetComponent <FighterPositions>();

        if (particleHitEffectPrefab != null && userPositions != null && targetPositions != null)
        {
            GameObject            hitEffect = Instantiate(particleHitEffectPrefab, targetPositions.damagePopup);
            ParticleSystemsHelper psh       = hitEffect.GetComponent <ParticleSystemsHelper>();
            hitEffect.GetComponent <DestroyAfterSeconds>().duration = GetAnimWindup();
            psh.SetDestroyDuration(GetAnimWindup());
            psh.SetRenderOrder(target.sortingOrder + 1);
            psh.PositionEffect(userPositions.damagePopup, targetPositions.damagePopup);
            psh.Play();
        }
    }
Example #5
0
    public void InitializePosition(FightingEntity player)
    {
        this.fighter          = player;
        this.fighter.targetId = this.slotIndex;
        player.transform.SetParent(this.instantiationTransform.transform, false);
        player.transform.localPosition = Vector3.zero;
        if (player.fighterMessageBox != null)
        {
            player.fighterMessageBox.Initialize(this.IsXFlipped());
        }

        player.fighterSlot = this;

        // Set arrows position based on fighter's specification
        WorldspaceToScreenUI parentPositioner = targetParent.GetComponent <WorldspaceToScreenUI>();

        parentPositioner.SetWorldPoint(fighter.GetComponent <FighterPositions>().arrows);
    }
Example #6
0
    private void SetMaterialOutline(int targetIndex, bool enabled)
    {
        FightingEntity           target           = potentialTargets[targetIndex];
        SkeletonMaterialOutliner materialOutliner = target.GetComponent <SkeletonMaterialOutliner>();

        if (materialOutliner == null)
        {
            return;
        }

        if (enabled)
        {
            materialOutliner.SetOutlineColor(this.targetSelectionColor);
        }
        else
        {
            materialOutliner.UnsetOutline();
        }
    }