1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
/***************************************************************************
ColorBehavior.cpp - description
-------------------
begin : Tue Feb 15 2000
copyright : (C) 2000 by Henrik Enqvist
email : henqvist@excite.com
***************************************************************************/
#include "Private.h"
#include "ColorBehavior.h"
#include "Group.h"
#include "Shape3D.h"
ColorBehavior::ColorBehavior() : Behavior() {
}
ColorBehavior::~ColorBehavior() {
}
void ColorBehavior::onCollision(const Vertex3D &, const Vertex3D &, Group *) {
EmAssert(this->getParent() != NULL, "ColorBehavior::onCollision parent NULL");
EM_COUT("ColorBehavior::onCollision()" << endl, 0);
if (this->getParent() != NULL) {
for (int a=0; a<this->getParent()->getShape3DSize(); a++) {
this->getParent()->getShape3D(a)->setColor(1.0, 1.0, 0.0, 0.0);
}
}
}
void ColorBehavior::onTick() {
EmAssert(this->getParent() != NULL, "ColorBehavior::onTick parent NULL");
for (int a=0; a<this->getParent()->getShape3DSize(); a++) {
this->getParent()->getShape3D(a)->setColor(1.0, 0.0, 0.0, 1.0);
}
}
|