Skip to content

Commit

Permalink
feat: Implement Trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
arcadien committed Nov 24, 2023
1 parent 12ac46a commit ff69877
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/Domain/Gun/Trigger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
*
* Copyright (c) 2023 Aurélien Labrosse
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Gun/Gun.hpp>
#include <Gun/Trigger.hpp>

void Trigger::setGun(Gun *gun) { this->gun = gun; }

void Trigger::onDown(long now) {
gun->activateShoot();
Contactor::onDown(now);
}
29 changes: 29 additions & 0 deletions lib/Domain/Gun/Trigger.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
*
* Copyright (c) 2023 Aurélien Labrosse
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <Contactor.hpp>

class Gun;

class Trigger : public Contactor {
Gun *gun;

public:
Trigger() : Contactor() {}
void setGun(Gun *gun);
void onDown(long now) override;
};

0 comments on commit ff69877

Please sign in to comment.