mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-27 10:14:39 +00:00
simple fixes
This commit is contained in:
parent
fbc6bd9a4c
commit
12857c2265
@ -12,13 +12,14 @@ namespace CRAWL {
|
||||
|
||||
Fire::Fire(): ParticleEffect(AUTO_CLASS_NAME, "qrc:/CrawlModule/particles/Fire.qml") {
|
||||
|
||||
useDirectionVelosity({0, 0 , 20}, {10, 10, 0});
|
||||
useDirectionVelosity({0, 0 ,0}, {10, 10, 0});
|
||||
setParticleScale(4);
|
||||
setParticleEndScale(12);
|
||||
setParticleScaleVariation(3);
|
||||
setLifeSpanVariation(500);
|
||||
setColor("#ffaf2c");
|
||||
setEnabled(true);
|
||||
setSize({1, 1, 1});
|
||||
setposition({0,0,10});
|
||||
|
||||
setParticleDelegate("qrc:/CrawlModule/particles/FireParticel.qml");
|
||||
|
||||
@ -43,7 +44,7 @@ void Fire::setFireStrength(float newFireStrength) {
|
||||
setLifeSpan(1000 + _fireStrength);
|
||||
|
||||
auto vel = static_cast<VectorDirection*>(velocity());
|
||||
vel->setVelosityDirection({0, 0 , _fireStrength});
|
||||
vel->setVelosityDirection({0, 0 , _fireStrength});
|
||||
vel->setVelosityDirectionValatility({10, 10, 0});
|
||||
|
||||
emit fireStrengthChanged();
|
||||
|
@ -23,6 +23,7 @@ ParticleEmitter3D {
|
||||
|
||||
depthBias: (model)? model.depthBias: 0
|
||||
emitRate: (model)? model.emitRate: 0
|
||||
|
||||
enabled: (model)? model.enabled: false
|
||||
lifeSpan: (model)? model.lifeSpan: 0
|
||||
lifeSpanVariation: (model)? model.lifeSpanVariation: 0
|
||||
@ -39,61 +40,74 @@ ParticleEmitter3D {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
Item {
|
||||
id: privateRoot
|
||||
target: model
|
||||
|
||||
property var velosity: (model)? model.velocity: null
|
||||
property string delegate: (model)? model.particleDelegate: ""
|
||||
property string particleShape: (model)? model.particleShape: ""
|
||||
property var view: null
|
||||
|
||||
function onVelocityChanged() {
|
||||
const objModel = model.velocity;
|
||||
onVelosityChanged: () => {
|
||||
if (!root.model)
|
||||
return;
|
||||
|
||||
if (!objModel) {
|
||||
if (view) {
|
||||
view.distory();
|
||||
}
|
||||
const objModel = root.model.velocity;
|
||||
|
||||
root.velocity = view = null;
|
||||
return;
|
||||
}
|
||||
if (!objModel) {
|
||||
if (view) {
|
||||
view.distory();
|
||||
}
|
||||
|
||||
const viewTemplate = objModel.viewTemplate;
|
||||
root.velocity = view = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (view.path !== viewTemplate) {
|
||||
let temp = Qt.createComponent(viewTemplate)
|
||||
if (temp.status === Component.Ready) {
|
||||
let obj = temp.createObject()
|
||||
obj.model = objModel;
|
||||
const viewTemplate = objModel.viewTemplate;
|
||||
|
||||
if (view) {
|
||||
view.distory();
|
||||
}
|
||||
if (!view || (view.path !== viewTemplate)) {
|
||||
let temp = Qt.createComponent(viewTemplate)
|
||||
|
||||
root.velocity = view = obj;
|
||||
} else {
|
||||
console.log("wrong viewTemplate in model " + temp.errorString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!temp)
|
||||
return
|
||||
|
||||
function onParticleDelegateChanged () {
|
||||
const viewTemplate = root.model.particleDelegate
|
||||
let temp = Qt.createComponent(viewTemplate)
|
||||
if (temp.status === Component.Ready) {
|
||||
root.particle = temp.createObject();
|
||||
} else {
|
||||
console.log("wrong viewTemplate in model " + temp.errorString());
|
||||
}
|
||||
}
|
||||
if (temp.status === Component.Ready) {
|
||||
let obj = temp.createObject(root)
|
||||
obj.model = objModel;
|
||||
|
||||
function onParticleShapeChanged() {
|
||||
const viewTemplate = root.model.particleShape
|
||||
let temp = Qt.createComponent(viewTemplate)
|
||||
if (temp.status === Component.Ready) {
|
||||
root.shape = temp.createObject();
|
||||
} else {
|
||||
console.log("wrong viewTemplate in model " + temp.errorString());
|
||||
}
|
||||
}
|
||||
if (view) {
|
||||
view.distory();
|
||||
}
|
||||
|
||||
root.velocity = view = obj;
|
||||
} else {
|
||||
console.log("wrong viewTemplate in model " + temp.errorString());
|
||||
}
|
||||
}
|
||||
}
|
||||
onDelegateChanged: () => {
|
||||
let temp = Qt.createComponent(privateRoot.delegate)
|
||||
|
||||
if (!temp)
|
||||
return
|
||||
|
||||
if (temp.status === Component.Ready) {
|
||||
root.particle = temp.createObject(root.parent);
|
||||
} else {
|
||||
console.log("wrong viewTemplate in model " + temp.errorString());
|
||||
}
|
||||
}
|
||||
|
||||
onParticleShapeChanged: () => {
|
||||
let temp = Qt.createComponent(privateRoot.particleShape)
|
||||
|
||||
if (!temp)
|
||||
return
|
||||
|
||||
if (temp.status === Component.Ready) {
|
||||
root.shape = temp.createObject(root.parent);
|
||||
} else {
|
||||
console.log("wrong viewTemplate in model " + temp.errorString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ CRAWL::WorldRule *World::initWorldRules() {
|
||||
using Day = CRAWL::Day<CRAWL::Sun, CRAWL::Moon>;
|
||||
|
||||
return new CRAWL::WorldRule {
|
||||
{0, {{registerObject<Box>(), 1000},
|
||||
{0, {{registerObject<Box>(), 100},
|
||||
{registerObject<CRAWL::Fire>(), 10},
|
||||
{registerObject<Background>(), 1},
|
||||
{registerObject<Day>(), 1}}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user