public func Initialize() { // Erst alle Komponenten löschen var i, id; while(id = GetComponent(0, i++, 0, GetID()) ) SetComponent(id, 0, this() ); SetComponent(ILOA, 3, this() ); }
void SetUp() override { dem = vtkSmartPointer<vtkImageData>::New(); dem->SetExtent(extent.data()); dem->AllocateScalars(VTK_FLOAT, 1); dem->GetIncrements(incs.GetData()); auto elevations = dem->GetPointData()->GetScalars(); elevations->SetName("Elevations"); for (vtkIdType i = 0; i < elevations->GetNumberOfTuples(); ++i) { elevations->SetComponent(i, 0, 0.f); } dem->SetScalarComponentFromFloat(2, 3, 0, 0, 1.0); dem->SetScalarComponentFromFloat(2, 4, 0, 0, 1.0); dem->SetScalarComponentFromFloat(2, 5, 0, 0, 2.0); }
// Callback by the engine when the completion of an object changes. global func OnCompletionChange(int old_con, int new_con) { if (!this || GetType(this) != C4V_C4Object) return _inherited(old_con, new_con, ...); // Determine whether the object allows Oversize. var oversize = GetDefCoreVal("Oversize", "DefCore"); // Loop over all components and set their new count. var index = 0, comp; while (comp = GetID()->GetComponent(nil, index)) { var def_cnt = GetID()->GetComponent(comp); var new_cnt = Max(def_cnt * new_con / 100000, 0); // If the object has no Oversize then constrain the maximum number of components. if (!oversize) new_cnt = Min(new_cnt, def_cnt); SetComponent(comp, new_cnt); index++; } return _inherited(old_con, new_con, ...); }
void GameObject::SetCComponent(void* ptr) { SetComponent(ptr, 2); }
void GameObject::SetMeshInstanceComponent(void* ptr) { SetComponent(ptr, 1); }
void GameObject::SetRigidBodyComponent(void* ptr) { SetComponent(ptr, 0); }