Пример #1
0
        void Attack()
        {
            if (!AttackTimer.Expired)
            {
                return;
            }

            if (AttackEntity == null)
            {
                return;
            }

            Vector3 directionToCharacter = AttackEntity.Transform.WorldMatrix.TranslationVector -
                                           Entity.Transform.WorldMatrix.TranslationVector;

            directionToCharacter.Y = 0;
            float currentDistance = directionToCharacter.Length();

            if (currentDistance <= AttackDistance)
            {
                // Attack!
                HaltMovement();

                AttackEntity = null;
                IsSearching  = true;
                AttackTimer.Reset(AttackCooldown);
                //BiteCollision.Enabled = true;
                System.Diagnostics.Debug.WriteLine("Cockroach Attacks.");
                PlayerRef.HitAttempt();
            }
            else
            {
                directionToCharacter.Normalize();
                UpdateDestination(AttackEntity.Transform.WorldMatrix.TranslationVector);
            }
        }
Пример #2
0
        protected void CollisionStarted(Player.PlayerController player)
        {
            //Action for hitting player.

            player.HitAttempt();
        }