예제 #1
0
        private bool InteractWithCombat()
        {
            foreach (var raycastHit in Physics.RaycastAll(GetMouseRay()))
            {
                CombatTarget target = raycastHit.transform.GetComponent <CombatTarget>();
                if (target == null)
                {
                    continue;
                }

                if (!GetComponent <Fighter>().CanAttack(target.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButton(0))
                {
                    _fighter.Attack(target.gameObject);
                }

                return(true);
            }

            return(false);
        }
예제 #2
0
        private void AttackBehaviour()
        {
            timeSinceLastSawPlayer = 0;
            fighter.Attack(player);

            AggrevateNearbyEnemies();
        }
예제 #3
0
        private bool InteractWithCombat()
        {
            RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());

            foreach (RaycastHit hit in hits)
            {
                CombatTarget target = hit.transform.GetComponent <CombatTarget>();

                if (!target)
                {
                    continue;
                }

                GameObject targetGameObject = target.gameObject;

                if (!fighter.CanAttack(targetGameObject))
                {
                    continue;
                }

                if (Input.GetMouseButton(0))
                {
                    fighter.Attack(targetGameObject);
                }

                return(true);
            }

            return(false);
        }
예제 #4
0
        private bool InteractWithCombat()
        {
            RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());

            foreach (RaycastHit hit in hits)
            {
                //check if the clickable object has a combat target if not fail
                CombatTarget target = hit.collider.GetComponent <CombatTarget>();
                if (target == null)
                {
                    continue;
                }

                //Checks if it has a health compnent if not fail
                if (!fighter.CanAttack(target.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButtonDown(0))
                {
                    fighter.Attack(target.gameObject);
                }
                return(true);
            }
            return(false);
        }
예제 #5
0
 private void AttackBehaviour()
 {
     lookAround         = false;
     head.localRotation = Quaternion.Euler(Vector3.zero); // while chasing player looking forward towards him
     agent.speed        = agentAttackSpeed;
     fighter.Attack(player);
 }
        private bool InteractWithCombat()
        {
            RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());
            foreach (RaycastHit hit in hits)
            {
                CombatTarget target = hit.collider.GetComponent <CombatTarget>();
                if (target == null)
                {
                    continue;
                }

                if (!GetComponent <Fighter>().CanAttack(target.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButton(0))
                {
                    fighter.Attack(target.gameObject);
                }

                return(true);
            }

            return(false);
        }
예제 #7
0
 private void Update()
 {
     if (health.IsDead)
     {
         this.enabled = false;
         return;
     }
     if (IsInRange(player.transform.position, chaseRange))
     {
         if (fighter.IsAttacking)
         {
             return;
         }
         if (fighter.CanAttack(player))
         {
             print(String.Format("Time for {0} to chase {1}", name, player));
             fighter.Attack(player);
             return;
         }
     }
     fighter.Cancel();
     if (!IsInRange(startPosition, 1))
     {
         mover.MoveToPosition(startPosition);
     }
 }
예제 #8
0
 private void AttackBehaviour()
 {   //********************//
     navMeshAgent.speed = 5f;
     //********************//
     timeSinceLastSawPlayer = 0;
     fighter.Attack(player);
 }
예제 #9
0
 // Update is called once per frame
 void Update()
 {
     if (health.IsDead())
     {
         return;
     }
     //chase and attack
     if (DistanceToPlayer() < chaseDistance && fighter.ShouldAttack(player))
     {
         timeFromLastSaw = 0;
         fighter.Attack(player);
     }
     // suspious
     else if (timeFromLastSaw < suspicionTime)
     {
         SuspiousState();
     }
     // back to patrol
     else
     {
         PatrolState();
     }
     timeFromLastSaw            += Time.deltaTime;
     timeFromDwellAtPatrolPoint += Time.deltaTime;
 }
예제 #10
0
        private bool InteractWithCombat()
        {
            Ray ray = GetMouseRay();

            RaycastHit[] hits = Physics.RaycastAll(ray);

            foreach (var hit in hits)
            {
                CombatTarget target = hit.transform.GetComponent <CombatTarget>();

                if (target == null)
                {
                    continue;
                }

                if (!_fighter.CanAttack(target.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButton(1))
                {
                    _fighter.Attack(target.gameObject);
                }

                return(true);
            }

            return(false);
        }
예제 #11
0
        private bool InteractWithCombat()
        {
            if (Input.GetKeyDown(KeyCode.Q))
            {
                _fighterSpell.Cast(CastSource.Weapon);
            }
            else if (Input.GetKeyDown(KeyCode.W))
            {
                _fighterSpell.Cast(CastSource.Armor);
            }
            else if (Input.GetKeyDown(KeyCode.E))
            {
                _fighterSpell.Cast(CastSource.Pet);
            }

            var hits = Physics.RaycastAll(GetMouseRay());

            foreach (var hit in hits)
            {
                var target = hit.transform.GetComponent <CombatTarget>();

                if (target == null || !Fighter.CanAttack(target.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButtonDown(0))
                {
                    _fighter.Attack(target.gameObject);
                }
                return(true);
            }
            return(false);
        }
예제 #12
0
        private bool InteractWithCombat()
        {
            // to find an object that might be obscured by another
            RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());

            foreach (RaycastHit hit in hits)
            {
                CombatTarget target = hit.transform.GetComponent <CombatTarget>();

                if (target == null)
                {
                    continue;
                }

                if (!fighter.CanAttack(target.gameObject))
                {
                    continue;
                }

                if (Input.GetMouseButton(0))
                {
                    fighter.Attack(target.gameObject);
                }
                // just hovering over the target OR is actively attacking it
                // able to change the UI cursor, for example
                // if i'm hovering an enemy, i wont display the movement cursor. Instead, i'll show the attack cursor
                return(true);
            }
            return(false);
        }
예제 #13
0
        void Update()
        {
            _timeSinceLastSawPlayer += Time.deltaTime;
            _timeSinceLastPatrolled += Time.deltaTime;
            _timeSinceAggravated    += Time.deltaTime;

            if (_player.IsAlive() && _fighter.enabled && ShouldAttack())
            {
                if (Vector3.Distance(transform.position, _player.transform.position) - _weaponsRange >= Mathf.Epsilon)
                {
                    _fighter.Attack(_player.gameObject);
                    _mover.SetSpeed(_chaseSpeed);
                }

                _timeSinceLastSawPlayer = 0;
            }
            else if (_timeSinceLastSawPlayer - _suspicionTime <= Mathf.Epsilon)
            {
                _mover.Cancel();
            }
            else
            {
                PatrolBehaviour();
            }
        }
예제 #14
0
        private void AttackBehaviour()
        {
            timeSinceLastSawPlayer = 0;
            fighter.Attack(player);

            AggrevateNearbyEnemies();
            StartCoroutine("WaitAttackFinish");
        }
예제 #15
0
        //Attack State
        private void AttackBehaviour()
        {
            // reseting time since last saw player
            timeSinceLastSawPlayer = 0;

            //Attack
            fighter.Attack(player);
        }
예제 #16
0
        void AttackBehaviour()
        {
            timeSinceLastSawPlayer = 0;
            //Debug.Log(name + " can chase player!!!");
            fighter.Attack(player.CombatTarget, false, true);

            AggrevateNearbyEnemies();
        }
예제 #17
0
        public override Attack Attack()
        {
            var attack = Fighter.Attack();

            attack.Value += AttackValue;
            attack.Messages.Add("Doubled the original attack value: " + AttackValue);
            return(base.Attack());
        }
        public override Attack Attack()
        {
            var attack = Fighter.Attack();

            AttackValue = Convert.ToInt32(AttackValue * _attackMultiplier);
            attack.Messages.Add("Strengthened your attack stat by: " + _attackMultiplier);
            return(attack);
        }
예제 #19
0
        private void AttackBehavior()
        {
            _fighter.Attack(_player);

            if (!_hasShout)
            {
                AggrevateNearbyEnemies();
            }
        }
예제 #20
0
        private void StartChaseBehaviour()
        {
            timeSinceLastSawPlayer = 0;

            if (fighter.CanAttack(player))
            {
                fighter.Attack(player);
            }
        }
예제 #21
0
        private void AttackBehaviour()
        {
            timeSinceLastSawPlayer = 0;
            fighter.Attack(player);

            AggrevateNearbyEnemies();

            //alter run speed here? nav mesh agent speed x factor
        }
예제 #22
0
        private void HandleAICombat()
        {
            if (DistanceToPlayer() > chaseDistance || !fighter.CanAttack(player))
            {
                fighter.Cancel();
                return;
            }

            fighter.Attack(player);
        }
 private bool AttackPlayer()
 {
     // if we are in distance we chase and attack player, while he is alive
     if (InAttackRange() && fighter.CanAttack(player))
     {
         fighter.Attack(player.gameObject);
         timeSinceLastSawPlayer = 0;    // each time we see the player we reset suspicion counter
         return(true);
     }
     return(false);
 }
예제 #24
0
 private void AttackBehaviour()
 {
     timeSinceLastSawPlayer = 0;
     fighter.Attack(player);
     if (spawnMaxDistance < Vector3.Distance(transform.position, spawnPoint))
     {
         Debug.Log("Ty smieciu, gdzie uciekasz");
         fighter.Cancel();
         PatrolBehaviour();
     }
 }
예제 #25
0
 private void Update()
 {
     if (InAttackRangeOfPlayer() && fighter.CanAttack(player))
     {
         fighter.Attack(player);
     }
     else
     {
         fighter.Cancel();
     }
 }
        public override Attack Attack()
        {
            var attack = Fighter.Attack();

            if (_minionLives > 0)
            {
                attack.Messages.Add("Minion helping the attack: " + _minionAttackValue);
                attack.Value += _minionAttackValue;
            }
            return(attack);
        }
예제 #27
0
 private void AttackBehaviour()
 {
     m_Fighter.Attack(m_Player);
     AggrevateNearbyEnemies();
     if (!m_HasNotAggrevated)
     {
         return;
     }
     m_HasNotAggrevated = false;
     Aggrevate();
 }
예제 #28
0
 private void HandleAttack()
 {
     if (CrossPlatformInputManager.GetButton("Fire1"))
     {
         myFighter.Attack();
     }
     else
     {
         myFighter.Prepared();
     }
 }
예제 #29
0
 private void Update()
 {
     if (IsInChaseRange() && _fighter.CanAttack(_player))
     {
         _fighter.Attack(_player);
     }
     else
     {
         _fighter.Cancel();
     }
 }
예제 #30
0
    public override void Activate(Fighter user, Fighter target)
    {
        float modiDamage = damage;

        modiDamage *= ((float)user.getstr() / 10f);
        Random.Range((-0.25f) * modiDamage, 0.25f * modiDamage);
        target.TakeDamage((int)modiDamage, element);
        user.Attack();
        Debug.Log(user.getname() + " uses " + name + " on " + target.getname() + " for " + modiDamage + ", Health Remaining " + target.getHP());
        Debug.Log("----------------------");
    }