Exemplo n.º 1
0
 /// <summary>
 /// От так
 /// </summary>
 /// <param name="player">Игрок</param>
 private void Attack(Game3DObject player)
 {
     _voice1.Stop();
     _voice2.Stop();
     _voice2.Play();
     _reloadComponent.StartReload();
     player.GetComponent <PlayerComponent>().RemoveHealth(_damage);
     new Animation(new float[] { 0f, -0.02f, 0.035f }, 0.5f).AddProcess((value) => {
         var position = GameObject.Children[1].LocalPosition;
         GameObject.Children[1].MoveBy(0, 0, value);
     });
 }
        public override void Update(float delta = 1)
        {
            var direction = _target.Position - GameObject.Position;

            direction.Normalize();
            GameObject.MoveBy(direction * delta * _flySpeed);
            if (ObjectCollision.Intersects(_target.Collision, GameObject.Collision))
            {
                var targetHealthComponent = _target.GetComponent <HealthComponent>();
                targetHealthComponent.DealDamage(_damage);
                GameObject.Scene.RemoveGameObject(GameObject);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Обработка попадания стрелы во врага
 /// </summary>
 /// <param name="enemy">Объект врага</param>
 protected override void HandleHitEnemy(Game3DObject enemy)
 {
     enemy.GetComponent <EnemyComponent>().MakeSlow(_slowTime);
     base.HandleHitEnemy(enemy);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Обработка попадания стрелы во врага
 /// </summary>
 /// <param name="enemy">Объект врага</param>
 protected virtual void HandleHitEnemy(Game3DObject enemy)
 {
     enemy.GetComponent <EnemyComponent>().RemoveHealth();
     GameObject.Scene.RemoveGameObject(GameObject);
     _colliderComponent.RemoveCollisionFromScene();
 }