Exemplo n.º 1
0
        public void AttachAbilityTo(GameObject gameObjectToAttachTo)
        {
            AbilityBehaviour behaviourComponent = GetBehaviourComponent(gameObjectToAttachTo);

            behaviourComponent.SetConfiguration(this);
            behaviour = behaviourComponent;
        }
Exemplo n.º 2
0
        public void AttachAbilityTo(GameObject objectToattachTo)
        {
            AbilityBehaviour behaviourComponent = GetBehaviourComponent(objectToattachTo);

            behaviourComponent.SetConfig(this);
            behaviour = behaviourComponent;
        }
Exemplo n.º 3
0
        public void AttachAbilityTo(GameObject gameObject)
        {
            AbilityBehaviour behaviourComponent = GetBehaviorComponent(gameObject);

            behaviourComponent.Config = this;
            behaviour = behaviourComponent;
        }
Exemplo n.º 4
0
        public void AttachAbility(GameObject gameObjectToAttachTo)
        {
            var behaviourComponent = GetAbilityBehaviour(gameObjectToAttachTo);

            behaviourComponent.SetConfig(this);
            behaviour = behaviourComponent;
        }
Exemplo n.º 5
0
        public void AttachAbilityTo(GameObject gameObjectToAttachTo)
        {
            AbilityBehaviour behaviourComponent = GetBehaviourComponent(gameObjectToAttachTo);

            behaviourComponent.Ability   = this;
            behaviourComponent.Character = gameObjectToAttachTo.GetComponent <Character>();
            behaviour = behaviourComponent;
        }
Exemplo n.º 6
0
        public void AttemptAbility(AbilityBehaviour abilityBehaviour, GameObject target = null)
        {
            var energyComponent = GetComponent <AbilityController>();
            var energyCost      = abilityBehaviour.Ability.Energy.Value;

            if (energyCost <= currentEnergyPoints)
            {
                ConsumeEnergy(energyCost);
                abilityBehaviour.Use(target);
            }
        }
Exemplo n.º 7
0
        protected IEnumerator StartCooldown(AbilityBehaviour behaviour)
        {
            float coolDown = config.GetCoolDown();

            canCastAbility = false;
            // Start ui cooldown.
            yield return(new WaitForSeconds(coolDown));

            canCastAbility = true;
            Debug.Log("Finished Cooldown");
        }
Exemplo n.º 8
0
        void ActivateAttack(AbilityBehaviour abilityBehaviour)
        {
            var abilityController = GetComponent <AbilityController>();
            var characterManager  = GetComponent <Character>();
            var weaponController  = GetComponent <WeaponController>();

            weaponController.Block(exitIndex);

            originalTarget = target;
            abilityController.AttemptAbility(abilityBehaviour, originalTarget);
        }
Exemplo n.º 9
0
        IEnumerator AttackTargetRepeatedly(AbilityBehaviour abilityBehaviour)
        {
            bool attackerStillAlive = healthController.HealthAsPercentage >= Mathf.Epsilon;
            bool targetStillAlive   = target.GetComponent <HealthController>().HealthAsPercentage >= Mathf.Epsilon;

            while (attackerStillAlive && targetStillAlive)
            {
                float timeToWait       = abilityBehaviour.Ability.AbilitySpeed.Value;
                bool  isTimeToHitAgain = Time.time - lastHitTime > timeToWait;

                if (isTimeToHitAgain && !characterManager.IsAttacking)
                {
                    abilityController.AttemptAbility(abilityBehaviour, target);
                    lastHitTime = Time.time;
                }
                yield return(new WaitForSeconds(timeToWait));
            }
        }
Exemplo n.º 10
0
 protected void SetBehaviour(AbilityBehaviour behaviourComponent)
 {
     behaviourComponent.SetConfig(this);
     behaviour = behaviourComponent;
 }
Exemplo n.º 11
0
 public void AddComponent(GameObject gameObjectToAttachTo)
 {
     behaviour = GetBehaviourComponent(gameObjectToAttachTo);
     behaviour.SetConfig(this);
 }