Ejemplo n.º 1
0
    public override void AddEffect(GameObject effectCauser, GameEvent gameEvent = GameEvent.DEFAULT)
    {
        owner = gameObject.GetComponent <Unit>();
        owner.effects.Add(this);

        //add exposed effect
        if (owner.GetComponent <Exposed>() == null)
        {
            Exposed exposed = owner.gameObject.AddComponent <Exposed>();
            exposed.AddEffect(owner.gameObject);
        }
        else if (!owner.GetComponent <Exposed>().enabled)
        {
            owner.GetComponent <Exposed>().enabled = true;
            owner.GetComponent <Exposed>().AddEffect(owner.gameObject);
        }

        if (owner.mainWeapon.weaponData.rangeType == WeaponData.Range.ranged)
        {
            owner.aimingBow = true;
        }
        owner.GetComponent <TacticsMovement>().FaceDirection(owner.focus.transform.position);

        if (owner.mainWeapon.weaponData.rangeType == WeaponData.Range.ranged)
        {
            primeAttackType = PrimeAttackType.AIMED;
            owner.unitAnim.SetBool("PrimeAimed", true);
        }
        else if (owner.mainWeapon.weaponData.rangeType == WeaponData.Range.melee && owner.mainWeapon.weaponData.weight >= ItemData.Weight.medium)
        {
            primeAttackType = PrimeAttackType.MIGHTY;
            owner.unitAnim.SetBool("PrimeMighty", true);
        }

        AttackManager.OnAttack        += BoostAttack;
        AttackManager.OnGraze         += GrazeRemovalCheck;
        AttackManager.OnWound         += GrazeRemovalCheck;
        TacticsMovement.OnEnterSquare += RemovalCheck;
        TacticsMovement.OnDodge       += DodgeRemovalCheck;
        Initiative.OnActionTaken      += MainActionTakenRemovalCheck;
        Unit.onSetFocus += FocusSetRemovalCheck;
        Unit.onKO       += DeathRemovalCheck;
    }