The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'! https://forums.lestoria.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
AdventuresInLestoria/Crawler/Monster.cpp

82 lines
1.9 KiB

#include "Monster.h"
extern std::map<AnimationState,Animate2D::FrameSequence>ANIMATION_DATA;
MonsterData::MonsterData(){}
MonsterData::MonsterData(int hp,int atk,std::vector<AnimationState>animations,float moveSpd,float size,MonsterStrategy strategy):
hp(hp),atk(atk),moveSpd(moveSpd),size(size),strategy(strategy),animations(animations){
}
int MonsterData::GetHealth(){
return hp;
}
int MonsterData::GetAttack(){
return atk;
}
float MonsterData::GetMoveSpdMult(){
return moveSpd;
}
float MonsterData::GetSizeMult(){
return size;
}
MonsterStrategy MonsterData::GetAIStrategy(){
return strategy;
}
Monster::Monster(){}
Monster::Monster(vf2d pos,MonsterData data):
pos(pos),hp(data.GetHealth()),maxhp(data.GetHealth()),atk(data.GetAttack()),moveSpd(data.GetMoveSpdMult()),size(data.GetSizeMult()),strategy(data.GetAIStrategy()){
bool firstAnimation=true;
for(AnimationState&anim:data.GetAnimations()){
animation.AddState(anim,ANIMATION_DATA[anim]);
if(firstAnimation){
animation.ChangeState(internal_animState,anim);
firstAnimation=false;
}
}
}
vf2d&Monster::GetPos(){
return pos;
}
int Monster::GetHealth(){
return hp;
}
int Monster::GetAttack(){
return atk;
}
float Monster::GetMoveSpdMult(){
return moveSpd;
}
float Monster::GetSizeMult(){
return size;
}
void Monster::UpdateAnimation(AnimationState state){
animation.ChangeState(internal_animState,state);
}
void Monster::Update(float fElapsedTime){
switch(strategy){
RUN_TOWARDS:{
}break;
SHOOT_AFAR:{
}break;
}
animation.UpdateState(internal_animState,fElapsedTime);
}
MonsterSpawner::MonsterSpawner(){}
MonsterSpawner::MonsterSpawner(vf2d pos,int range,std::vector<std::pair<MonsterData,vf2d>>monsters):
pos(pos),range(range),monsters(monsters){
}
bool MonsterSpawner::SpawnTriggered(){
return triggered;
}
int MonsterSpawner::GetRange(){
return range;
}
vf2d MonsterSpawner::GetPos(){
return pos;
}
void MonsterSpawner::SetTriggered(bool trigger){
triggered=trigger;
}