Commits

Anonymous committed 934e79f Merge

Merge

Comments (0)

Files changed (2)

src/ai_core/AIComponent.h

 	void Move(vector<float> targetLocation);
 };
 
+AIBehavior::AIBehavior()
+{
+	aiHasBall = false;
+	playerHasBall = false;
+}
+
 void AIBehavior::ChangeState(string state){
 	//add switch statement to call any function needed based on the string input
 	//this function should be called in the main loop

src/ai_core/AICore.h

+/**
+* @AICore.h
 /**
 * @AICore.h
 * @Brian Howell, Dan Padeiro, Kevin Kasson, Scott Compton
 #pragma once
 
 
-#include "../src/CoreInterface.h"
+#include "CoreInterface.h"
 #include <string>
 #include <map>
 #include <vector>
 #include "AIComponent.h"
+#include "../GlobalProperties.h"
+#include "../Entity.h"
+#include "../Envelope.h"
+#include "../MessageDispatcher.h"
+
 
 // AICore.h written by Brian Howell is to represent an extended
 // version of CoreInterface.h which introduces funcions for the AI core
 
 class AICore : public CoreInterface {
 public:
-	AICore(GlobalProperties* gprops, MessageDispatcher* msgdisp) : CoreInterface(gprops, msgdisp) {
+        AICore(GlobalProperties* gprops, MessageDispatcher* msgdisp) : CoreInterface(gprops, msgdisp) {
 
-	}
+        }
 
-	//pure virtual functions from CoreInterface to be overrode for AICore functionality
-	void Message(int msg, EnvelopeAny* e);
-	void Update(double dt);
-	void Pause();
-	void Resume();
-	bool Startup();
-	void Shutdown();
-	void CreateComponent(std::string type, std::map< std::string, boost::any > &attributes, Entity* e);
-	void RegisterComponent(ComponentInterface* comp);
-	
+        //pure virtual functions from CoreInterface to be overrode for AICore functionality
+        void Message(int msg, EnvelopeAny* e);
+        void Update(double dt);
+        void Pause();
+        void Resume();
+        bool Startup();
+        void Shutdown();
+        void CreateComponent(std::string type, std::map< std::string, boost::any > &attributes, Entity* e);
+        void RegisterComponent(ComponentInterface* comp);
+
+		int Paused, Updated, Started, ShutDowned;
+        
 };
 
 void AICore::Message(int msg, EnvelopeAny* e){
-	//something can go here later if need be
+        msghndlr->SendMessageAny( msg, e );
 }
 
 void AICore::Update(double dt){
-	//something can go here later if need be
+       
+	Updated = 4777;
+	this->deltaAccumulator += dt;
+		
+		
+		if (this->deltaAccumulator >= 1) {
+			// Reset the time accumulator
+			this->deltaAccumulator = 0.0;
+		}
+	AIBehavior* b = new AIBehavior;
+	EnvelopeAny* envMsg = new EnvelopeAny();
+	envMsg->AddData(b);
+
+
+	Message(Updated, envMsg);
 }
 
 void AICore::Pause(){
-	//something can go here later if need be
+       
+	Paused = 4555;
+	AIBehavior* b = new AIBehavior;
+	EnvelopeAny* envMsg = new EnvelopeAny();
+	envMsg->AddData(b);
+
+
+	Message(Updated, envMsg);
 }
 
 void AICore::Resume(){
-	//something can go here later if need be
+        //something can go here later if need be
 }
 
 bool AICore::Startup(){
-	//something can go here later if need be
+    
+	Started = 4111;
+	AIBehavior* b = new AIBehavior;
+	EnvelopeAny* envMsg = new EnvelopeAny();
+	envMsg->AddData(b);
+
+
+	Message(Started, envMsg);
 	return true;
 }
 
 void AICore::Shutdown(){
-	//something can go here later if need be
+       
+	ShutDowned = 4999;
+	AIBehavior* b = new AIBehavior;
+	EnvelopeAny* envMsg = new EnvelopeAny();
+	envMsg->AddData(b);
+
+
+	Message(ShutDowned, envMsg);
 }
 
 void AICore::CreateComponent(std::string type, std::map< std::string, boost::any > &attributes, Entity* e) {
-	//something can go here later if need be
+        //something can go here later if need be
 	AIBehavior* aicomp = new AIBehavior(e, this);
 	this->components[e->id] = aicomp;
 
 }
 
 void AICore::RegisterComponent(ComponentInterface* comp){
-	//something can go here later if need be
-}
+        //something can go here later if need be
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.