Exemplo n.º 1
0
    public void InitializeProjectile(Character _Owner, ItemSkill _SourceItemSkill, SkillType _SourceSkill)
    {
        // Link Skill User and Skill:
        Owner           = _Owner;
        SourceSkill     = _SourceSkill;
        SourceItemSkill = _SourceItemSkill;

        // Calculate which Team(s) the Projectile can hit:
        int counter = 0;

        if (SourceSkill.GetAllowTargetFriendly())
        {
            counter += (int)(Owner.GetAlignment());
        }

        if (SourceSkill.GetAllowTargetEnemy())
        {
            counter += ((int)(Owner.GetAlignment()) % 2) + 1;
        }

        ProjectileAlignment = (Character.TeamAlignment)(counter);

        // Calculate the direction in which the projectile flies:
        FlyDirection = Vector3.forward;//Owner.transform.forward;
    }
Exemplo n.º 2
0
    public void StartSkillCurrentlyUsingItemHitBox(ItemSkill SourceItemSkill, SkillType SourceSkill, bool HitEachCharacterOnce)
    {
        if (SkillCurrentlyUsingItemHitBox)
        {
            Debug.Log("WARNING: " + SourceSkill + " overwrites existing " + SkillCurrentlyUsingItemHitBox + " Skill for use of Item Hit Box!");
        }

        CanHitCharactersOnlyOnce          = HitEachCharacterOnce;
        SkillCurrentlyUsingItemHitBox     = SourceSkill;
        ItemSkillCurrentlyUsingItemHitBox = SourceItemSkill;
        AlreadyHitCharacters = new List <Character>();

        // Calculate which Team(s) the Item can hit:
        int counter = 0;

        if (SourceSkill.GetAllowTargetFriendly())
        {
            counter += (int)(CurrentOwner.GetAlignment());
        }

        if (SourceSkill.GetAllowTargetEnemy())
        {
            counter += ((int)(CurrentOwner.GetAlignment()) % 2) + 1;
        }

        CurrentItemHitBoxAlignment = (Character.TeamAlignment)(counter);

        // Try to hit all Characters already in the hit box:

        List <Character> CleanUpMissingCharacters = new List <Character>();

        for (int i = 0; i < CurrentlyCollidingCharacters.Count; i++)
        {
            if (CurrentlyCollidingCharacters[i] == null)
            {
                CleanUpMissingCharacters.Add(CurrentlyCollidingCharacters[i]);
            }
            else if (CheckIfEnterCharacterLegit(CurrentlyCollidingCharacters[i]))
            {
                ApplyCurrentSkillEffectsToCharacter(CurrentlyCollidingCharacters[i]);
            }
        }

        for (int i = 0; i < CleanUpMissingCharacters.Count; i++)
        {
            CurrentlyCollidingCharacters.Remove(CleanUpMissingCharacters[i]);
        }
    }
Exemplo n.º 3
0
    public virtual void InitializeHitObject(Character _Owner, ItemSkill _SourceItemSkill, SkillType _SourceSkill, bool UseLevelAtActivationMoment)
    {
        // Link Skill User and Skill:
        Owner           = _Owner;
        SourceSkill     = _SourceSkill;
        SourceItemSkill = _SourceItemSkill;
        _audioSource    = GetComponent <AudioSource>();


        if (UseLevelAtActivationMoment)
        {
            FixedLevel = SourceItemSkill.GetSkillLevel();
        }
        else
        {
            FixedLevel = -1;
        }

        // Calculate which Team(s) the HitObject can hit:
        int counter = 0;

        if (SourceSkill.GetAllowTargetFriendly())
        {
            counter += (int)(Owner.GetAlignment());
        }

        if (SourceSkill.GetAllowTargetEnemy())
        {
            counter += ((int)(Owner.GetAlignment()) % 2) + 1;
        }

        HitObjectAlignment = (Character.TeamAlignment)(counter);

        // Living Time:
        if (MaxTimeAlive <= 0)
        {
            SourceItemSkill.AddEffectSkillHitObject(this);
        }

        if (TickTime > 0)
        {
            CurrentTickTime = TickTime;
        }

        // Parenting:
        if (HitObjectIsChildOfOwner)
        {
            transform.SetParent(Owner.transform);
        }

        if (AlwaysHitOwner)
        {
            HitTarget(Owner);
        }

        // Threat:
        Threat = SourceSkill.GetThreat();

        // Force Impulse:
        if (UseForceImpulse)
        {
            ApplyForceImpulse();
        }

        if (UseFixedTerrainHeight)
        {
            TerrHeightLayerMask = 1 << TerrHeightLayerMask;
        }
    }