示例#1
0
 public void Hitbox_BodyEntered(KinematicBody2D body)
 {
     if (body.IsInGroup("roach"))
     {
         _isRecover = false;
         ((Health)GetNode("Health")).Damage(5);
     }
     else if (body.IsInGroup("enemy"))
     {
         _isRecover = false;
         ((Health)GetNode("Health")).Damage(1);
     }
 }
示例#2
0
 public void _on_Area2D_body_entered(KinematicBody2D body)
 {
     if (body.IsInGroup(ENEMY_GROUP))
     {
         (body as Seagull).Die();
         camera.Shake();
         Score.instance.KillCount += 1;
         RefreshAfterKill();
     }
     else if (body.IsInGroup(FECES_GROUP))
     {
         lost = true;
         poopAudio.Play();
     }
 }
示例#3
0
 public void _on_Area2D_body_entered(KinematicBody2D area)
 {
     if (area.IsInGroup("enemy"))
     {
         ChangeState("Dead");
     }
 }
示例#4
0
 private void _on_Exit_body_entered(KinematicBody2D body)
 {
     if (body.IsInGroup("player"))
     {
         GetTree().ChangeScene("res://Levels/WinScreen.tscn");
     }
 }
示例#5
0
 private void _on_Area2D_body_exited(KinematicBody2D body)
 {
     if (body.IsInGroup("player"))
     {
         _canChase = false;
         ChangeState("Wander");
     }
 }
示例#6
0
 private void _on_Area2D_body_entered(KinematicBody2D body)
 {
     if (body.IsInGroup("player"))
     {
         _canChase = true;
         GetNode <Timer>("States/Wander/WanderTimer").Stop();
         ChangeState("Chase");
     }
 }
示例#7
0
    void PotentialTargetExited(KinematicBody2D body)
    {
        if (body.IsInGroup("EnemyTarget"))
        {
            nTarget = null;
        }

        //GD.Print($"{body.Name} exited");
    }
示例#8
0
    void PotentialTargetDetected(KinematicBody2D body)
    {
        if (body.IsInGroup("EnemyTarget"))
        {
            nTarget = body;
        }

        //GD.Print($"{body.Name} entered");
    }
示例#9
0
 private async void OnDoorDetection_BodyEntered(KinematicBody2D body)
 {
     if (body.IsInGroup("player"))
     {
         AudioSystem.PlaySFX(AudioSystem.SFXCollection.GuildHallEnter);
         await Autoload.Get <Transitions>().ChangeSceneDoubleTransition
             (WorldScenePath,
             new Transitions.TransitionParams(
                 Transitions.TransitionType.ShrinkingCircle, 0.3f));
     }
 }
示例#10
0
        private async void OnDoorDetection_BodyEntered(KinematicBody2D body)
        {
            if (body.IsInGroup("player"))
            {
                var offset = new Vector2(0, 5);
                SaveManager.SaveData.WorldPosition = _player.Position + offset;

                AudioSystem.PlaySFX(AudioSystem.SFXCollection.GuildHallEnter);
                var transitionParams =
                    new Transitions.TransitionParams(
                        Transitions.TransitionType.ShrinkingCircle, 0.3f);

                await Autoload.Get <Transitions>()
                .ChangeSceneDoubleTransition(GuildHallScenePath, transitionParams);
            }
        }
示例#11
0
    protected override void OnCantMoveRigidBody2D(KinematicBody2D go)//sino puede moverse por un kinematicbody como un personaje
    {
        GD.Print("enemigo colisionando con alguien");
        //parece que hay un bug cuando colisionan entre enemigos por eso verifico si esta en el grupo player el cuerpo kinematico
        if (go.IsInGroup("Player")) //detectamos que esta en el grupo player para evitar un bug al solicionar los enemigos entre sí
        {
            hitPlayer = (Player)go; //de esta forma tendria que acceder al script que tiene el personaje
        }

        if (hitPlayer != null)                                                //si estoy en la casilla player
        {
            hitPlayer.LoseFood(playerDamage);                                 //descuento comida del personaje

            playback.Travel("EnemyAttack");                                   //el enemigo ataca cuando le quitamos puntos al jugador
            _GameManager.RandomizeSfx(scavengers_enemy, scavengersEnemyNode); //activo sonido golpe
            if (hitPlayer.food >= 10)                                         //si la comida del personaje es mayor o igual a 10
            {
                AnimationPlayerEfectos.Play("pantallaRoja");                  //play color rojo en pantalla
                AnimationPlayerEfectos.PlayBackwards("pantallaRoja");         //play al reves color rojo en pantalla para que quede transparente
            }
        }
    }