本文整理汇总了C#中System.Entity.GetAnimationState方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.GetAnimationState方法的具体用法?C# Entity.GetAnimationState怎么用?C# Entity.GetAnimationState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.GetAnimationState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAnimationState
public void GetAnimationState(Entity entity)
{
Entity = entity;
State = Entity.GetAnimationState(StateName);
State.Loop = Loop;
State.Weight = 0;
}
示例2: BodyCollisionTree
public BodyCollisionTree(Entity bodyEntity, IEnumerable<string> animationNames)
{
Parent = bodyEntity.ParentSceneNode;
Root = new MirrorNode(Parent, bodyEntity.Skeleton.GetBoneIterator().First(x => x.Parent == null));
foreach (string name in animationNames.Where(x => bodyEntity.Skeleton.HasAnimation(x)))
{
Animations.Add(bodyEntity.Skeleton.GetAnimation(name));
AnimationStates.Add(bodyEntity.GetAnimationState(name));
}
foreach (MirrorNode node in Root.GetEnumerable())
MirrorMapper.Add(node.Name, node);
}
示例3: Enemy
public Enemy(CharacterProfile profile, bool czyPojemnik, float zasiegWzr, float zasiegOgl)
{
Profile = profile.Clone();
_Orientation = Quaternion.IDENTITY;
Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
Node.AttachObject(Entity);
Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor;
ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
Node,
Quaternion.IDENTITY,
0.1f,
Engine.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
inertia *= Profile.BodyMass;
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.AttachNode(Node);
Body.SetMassMatrix(Profile.BodyMass, inertia);
Body.AutoSleep = false;
Body.Transformed += BodyTransformCallback;
Body.ForceCallback += BodyForceCallback;
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.EnemyMaterialID;
Joint upVector = new MogreNewt.BasicJoints.UpVector(
Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y);
collision.Dispose();
isContainer = czyPojemnik;
isSeen = false;
isReachable = false;
_ZasiegWzroku = zasiegWzr;
_ZasiegOgolny = zasiegOgl;
_Statistics = Profile.Statistics.statistics_Clone();
State = StateTypes.IDLE;
//DROPPRIZE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
if (Profile.DropPrizeID == "")
Profile.DropPrizeID = "pPusty";
DropPrize = PrizeManager.P[Profile.DropPrizeID].prize_Clone();
List<DescribedProfile> lista_tym = new List<DescribedProfile>();
List<DescribedProfile> lista_tym2 = new List<DescribedProfile>(DropPrize.ItemsList);
if (DropPrize.ItemsList.Count > 2)
{
for (int i = 0; i < 2; i++)
{
int Los = Engine.Singleton.Random.Next(lista_tym2.Count);
lista_tym.Add(lista_tym2[Los]);
lista_tym2.RemoveAt(Los);
DropPrize.ItemsList = new List<DescribedProfile>(lista_tym);
}
}
else
DropPrize.ItemsList = new List<DescribedProfile>(DropPrize.ItemsList);
DropPrize.AmountGold = Engine.Singleton.Random.Next(DropPrize.AmountGold / 2, DropPrize.AmountGold + 1);
DropExp = DropPrize.AmountExp;
//PO DROPPRIZIE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
walkAnim = Entity.GetAnimationState("WALK");
idleAnim = Entity.GetAnimationState("IDLE");
attackAnim = Entity.GetAnimationState("ATTACK");
deadAnim = Entity.GetAnimationState("DEAD");
//Animation("IdleLegs").Enabled = true;
//Animation("IdleLegs").Loop = true;
FriendlyType = Profile.FriendlyType;
ProfName = Profile.ProfileName;
}
示例4: CreateThings
/// <summary>
/// create a bunch of crap
/// </summary>
void CreateThings()
{
Light light = mogreImageSource.SceneManager.CreateLight("sun2");
light.Type = Light.LightTypes.LT_DIRECTIONAL;
light.Direction = new Vector3(-0.1f, -1, 0.1f);
light.Direction.Normalise();
light.DiffuseColour = new ColourValue(1f, 1f, 1f);
light.SpecularColour = new ColourValue(1f, 1f, 1f);
light.Position = new Vector3(0, 10, 0);
light.CastShadows = true;
ponyNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
ponyEnt = sceneMgr.CreateEntity("BgPonyColtBody.mesh");
ponyNode.AttachObject(ponyEnt);
ponyNode.Position = new Vector3(0, 0, 0);
ponyEnt.SetMaterialName("BgPony");
wingsEnt = sceneMgr.CreateEntity("BgPonyColtWings.mesh");
wingsEnt.SetMaterialName("BgPonyWings");
hornEnt = sceneMgr.CreateEntity("BgPonyHorn.mesh");
hornEnt.SetMaterialName("BgPonyHorn");
eyesEnt = sceneMgr.CreateEntity("BgPonyColtEyes.mesh");
eyesEnt.SetMaterialName("BgPonyEyes");
foldedWingsEnt = sceneMgr.CreateEntity("BgPonyColtWingsFolded.mesh");
foldedWingsEnt.SetMaterialName("BgPonyWingsFolded");
hairEnts = new Entity[NUMBER_OF_HAIRSTYLES];
maneEnts = new Entity[NUMBER_OF_HAIRSTYLES];
tailEnts = new Entity[NUMBER_OF_HAIRSTYLES];
for (int a = 0; a < NUMBER_OF_HAIRSTYLES; a++) {
hairEnts[a] = sceneMgr.CreateEntity("BgPonyHair" + (a + 1) + ".mesh");
hairEnts[a].SetMaterialName("BgPonyHair_Double_" + (a + 1));
maneEnts[a] = sceneMgr.CreateEntity("BgPonyMane" + (a + 1) + ".mesh");
maneEnts[a].SetMaterialName("BgPonyHair_Double_" + (a + 1));
tailEnts[a] = sceneMgr.CreateEntity("BgPonyTail" + (a + 1) + ".mesh");
tailEnts[a].SetMaterialName("BgPonyHair_Double_" + (a + 1));
}
wingsEnt.Visible = false;
foldedWingsEnt.Visible = false;
hornEnt.Visible = false;
for (int a = 1; a < NUMBER_OF_HAIRSTYLES; a++) {
hairEnts[a].Visible = false;
maneEnts[a].Visible = false;
tailEnts[a].Visible = false;
}
AdjustBodyColour(bodyColour);
AdjustBodyAOColour(bodyAOColour);
AdjustHairColour1(hairColour1);
AdjustHairColour2(hairColour2);
AdjustHairAOColour1(hairAOColour1);
AdjustHairAOColour2(hairAOColour2);
// attach stuff
ponyEnt.AttachObjectToBone("Eyes", eyesEnt);
ponyEnt.AttachObjectToBone("Horn", hornEnt);
ponyEnt.AttachObjectToBone("Wings", wingsEnt);
ponyEnt.AttachObjectToBone("Wings", foldedWingsEnt);
for (int a = 0; a < NUMBER_OF_HAIRSTYLES; a++) {
ponyEnt.AttachObjectToBone("Hair", hairEnts[a]);
ponyEnt.AttachObjectToBone("Mane", maneEnts[a]);
ponyEnt.AttachObjectToBone("Tail", tailEnts[a]);
}
// setup animations
Skeleton skeleton = ponyEnt.Skeleton;
skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_CUMULATIVE;
// set up the blink animation state with some stuff
blinkState = ponyEnt.GetAnimationState("Blink2");
blinkState.Enabled = true;
blinkState.Loop = true;
blinkState.Weight = 1;
blinkState.CreateBlendMask(skeleton.NumBones, 0f);
ushort handle = skeleton.GetBone("EyeBrowTop.R").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
handle = skeleton.GetBone("EyeBrowBottom.R").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
handle = skeleton.GetBone("EyeBrowTop.L").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
handle = skeleton.GetBone("EyeBrowBottom.L").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
animState = ponyEnt.GetAnimationState("Stand1");
wingsState = wingsEnt.GetAnimationState("Flap1");
maneStates = new AnimationState[NUMBER_OF_HAIRSTYLES];
tailStates = new AnimationState[NUMBER_OF_HAIRSTYLES];
//.........这里部分代码省略.........
示例5: BackgroundPony
//.........这里部分代码省略.........
SetMaterialFragmentParameter(newMat, 0, "OutlineColour", hairAOColour2);
else if (int.Parse(_data[32], culture) == 1)
SetMaterialFragmentParameter(newMat, 0, "OutlineColour", hairAOColour1);
}
hairEnt.SetMaterial(newMat);
maneEnt.SetMaterial(newMat);
tailEnt.SetMaterial(newMat);
}
// one colour
else {
MaterialPtr originalMat = MaterialManager.Singleton.GetByName("BgPonyHair_Single_" + hairstyleID);
MaterialPtr newMat = MaterialManager.Singleton.GetByName("BgPonyHair_Single_" + hairstyleID + nameOfPonyCharacter);
if (newMat == null) {
newMat = originalMat.Clone("BgPonyHair_Single_" + hairstyleID + nameOfPonyCharacter);
var ps = newMat.GetTechnique(0).GetPass(1).GetFragmentProgramParameters();
ps.SetNamedConstant("HairColour", hairColour1);
ps.SetNamedConstant("AOColour", hairAOColour1);
newMat.GetTechnique(0).GetPass(1).SetFragmentProgramParameters(ps);
SetMaterialFragmentParameter(newMat, 0, "OutlineColour", hairAOColour1);
}
hairEnt.SetMaterial(newMat);
maneEnt.SetMaterial(newMat);
tailEnt.SetMaterial(newMat);
}
}
#endregion
#region animation
// make sure our animations add their weights and don't just average out. The AnimationBlender already handles averaging between two anims.
Skeleton skeleton = bodyEnt.Skeleton;
skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_CUMULATIVE;
// set up the blink animation state with some stuff
blinkState = bodyEnt.GetAnimationState("Blink2");
blinkState.Enabled = true;
blinkState.Loop = true;
blinkState.Weight = 1;
blinkState.AddTime(ID);
// set up all of the animation states to not use the neck bone
neckbone = skeleton.GetBone("Neck");
neckbone.SetManuallyControlled(true);
foreach (var state in bodyEnt.AllAnimationStates.GetAnimationStateIterator()) {
// don't add a blend mask to the blink state because we'll make a different one for it
if (state == blinkState)
continue;
state.CreateBlendMask(skeleton.NumBones);
state.SetBlendMaskEntry(neckbone.Handle, 0f);
}
neckbone.InheritOrientation = false;
neckFacing = new Euler(0, 0, 0);
// set up a blend mask so only the eyebrow bones have any effect on the blink animation
blinkState.CreateBlendMask(skeleton.NumBones, 0f);
ushort handle = skeleton.GetBone("EyeBrowTop.R").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
handle = skeleton.GetBone("EyeBrowBottom.R").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
handle = skeleton.GetBone("EyeBrowTop.L").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
handle = skeleton.GetBone("EyeBrowBottom.L").Handle;
blinkState.SetBlendMaskEntry(handle, 1f);
// add the blink state to the animation manager so it has time added to it
AnimationManager animMgr = LKernel.GetG<AnimationManager>();
animMgr.Add(blinkState);
// set up other animated things
bodyBlender = new AnimationBlender(bodyEnt);
bodyBlender.Init("Stand1", true);
animMgr.Add(bodyBlender);
maneBlender = new AnimationBlender(maneEnt);
maneBlender.Init("Stand1", true);
animMgr.Add(maneBlender);
tailBlender = new AnimationBlender(tailEnt);
tailBlender.Init("Stand1", true);
animMgr.Add(tailBlender);
if (PonyType == Type.FlyingPegasus) {
wingsBlender = new AnimationBlender(wingsEnt);
wingsBlender.Init("Flap1", true);
animMgr.Add(wingsBlender);
}
// set up some timers to handle animation changing
animTimer = new Timer(new TimerCallback(AnimTimerTick), null, random.Next(ANIMATION_TIMESPAN_MINIMUM, ANIMATION_TIMESPAN_MAXIMUM), Timeout.Infinite);
// add a bit of time to things so the animations aren't all synced at the beginning
AddTimeToBodyManeAndTail();
#endregion
followKart = LKernel.GetG<PlayerManager>().MainPlayer.Kart;
LKernel.GetG<Root>().FrameStarted += FrameStarted;
}