Exemple #1
0
        public ChainedAbility(IAbility ability, TargetType targetType, bool mustBeReady)
        {
            Instance    = ability;
            TargetType  = targetType;
            MustBeReady = mustBeReady;

            ClassType = Instance.GetType();
        }
        public ChainedAbility(IAbility ability, TargetType targetType, bool mustBeReady)
        {
            Instance = ability;
            TargetType = targetType;
            MustBeReady = mustBeReady;

            ClassType = Instance.GetType();
        }
Exemple #3
0
        Type GetAbilityType(IAbility ability)
        {
            if (ReferenceEquals(ability, null))
            {
                return(null);
            }

            return(ability.GetType());
        }
 public bool Contains(IAbility ability)
 {
     foreach (var item in _abilities.ToList())
     {
         if (ability.GetType() == item.GetType())
         {
             return(true);
         }
     }
     return(false);
 }
    public void ExecuteAbility(int index)
    {
        IAbility   ability   = (IAbility)this.abilities [index];
        ICharacter character = gameObject.GetComponentInParent <ICharacter> ();

        if (ability.GetType() == typeof(BasicAttack) && ability.Cooldown())
        {
            IAnim proj = gameObject.GetComponentInChildren <ProjectileAnim> ();
            proj.Animate(ability, character);
        }
        else if (ability.GetType() == typeof(Rush) && ability.Cooldown())
        {
            IAnim rush = gameObject.GetComponentInChildren <RushAnim> ();
            rush.Animate(ability, character);
            ability.ApplyAbility(character);
        }
        else if (ability.GetType() == typeof(BurstJump) && ability.Cooldown())
        {
            IAnim jump = gameObject.GetComponentInChildren <BurstJumpAnim> ();
            jump.Animate(new BasicAttack("Projectile", 2.5f, 2.5f, 2.5f, 2.5f, 0.5f), character);
            ability.ApplyAbility(character);
        }
        else if (ability.GetType() == typeof(GrenadeToss) && ability.Cooldown())
        {
            IAnim toss = gameObject.GetComponentInChildren <GrenadeTossAnim> ();
            toss.Animate(ability, character);
        }
        else if (ability.GetType() == typeof(DeathLazer) && ability.Cooldown())
        {
            IAnim lazer = gameObject.GetComponentInChildren <DeathLazerAnim> ();
            lazer.Animate(ability, character);
        }
        else if (ability.GetType() == typeof(MeleeAttack) && ability.Cooldown())
        {
            IAnim melee = gameObject.GetComponentInChildren <MeleeAnim> ();
            melee.Animate(ability, character);
        }
        else
        {
            if (ability != null)
            {
                if (ability.Cooldown())
                {
                    ability.ApplyAbility(character);
                }
            }
        }
    }
Exemple #6
0
 /// <summary>
 /// Adds an ability.
 /// </summary>
 /// <param name="ability">The ability to add.</param>
 public void Can(IAbility ability)
 {
     Logger.Info($"Adding ability for {this} to {ability}");
     Abilities.Add(ability.GetType(), ability);
 }