54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
namespace Passer.CreatureControl {
|
|
|
|
public class Insect : Creature {
|
|
|
|
public InsectRig insectRig;
|
|
|
|
public float forwardSpeed = 1;
|
|
public float rotationSpeed = 1;
|
|
|
|
public Leg leftFrontLeg;
|
|
public Leg leftMiddleLeg;
|
|
public Leg leftHindLeg;
|
|
|
|
public Leg rightFrontLeg;
|
|
public Leg rightMiddleLeg;
|
|
public Leg rightHindLeg;
|
|
|
|
#region Init
|
|
|
|
public override bool CheckTargetRig() {
|
|
bool anythingChanged = base.CheckTargetRig("InsectTargetRig");
|
|
if (anythingChanged || this.insectRig == null) {
|
|
this.insectRig = this.targetRig as InsectRig;
|
|
return true;
|
|
}
|
|
else
|
|
return anythingChanged;
|
|
}
|
|
|
|
#endregion Init
|
|
|
|
#region Update
|
|
|
|
public override void UpdateModel() {
|
|
base.UpdateModel();
|
|
|
|
if (this.insectRig.leftFrontLeg != null)
|
|
this.insectRig.leftFrontLeg.UpdateBones(this.leftFrontLeg);
|
|
if (this.insectRig.leftMiddleLeg != null)
|
|
this.insectRig.leftMiddleLeg.UpdateBones(this.leftMiddleLeg);
|
|
if (this.insectRig.leftBackLeg != null)
|
|
this.insectRig.leftBackLeg.UpdateBones(this.leftHindLeg);
|
|
|
|
if (this.insectRig.rightFrontLeg != null)
|
|
this.insectRig.rightFrontLeg.UpdateBones(this.rightFrontLeg);
|
|
if (this.insectRig.rightMiddleLeg != null)
|
|
this.insectRig.rightMiddleLeg.UpdateBones(this.rightMiddleLeg);
|
|
if (this.insectRig.rightBackLeg != null)
|
|
this.insectRig.rightBackLeg.UpdateBones(this.rightHindLeg);
|
|
}
|
|
|
|
#endregion Update
|
|
}
|
|
} |