本文整理汇总了C#中Entity.Position方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Position方法的具体用法?C# Entity.Position怎么用?C# Entity.Position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity.Position方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CubeField
public CubeField(Entity parent)
{
Position(parent.Position());
SetParent(parent);
InitChildren();
InitAI();
}
示例2: ApplyGravity
public void ApplyGravity(Entity body)
{
var r = Position() - body.Position();
var G = 10.0f;
var m1 = rigidBody.mass;
var m2 = body.rigidBody.mass;
var force = G * m1 * m2 / Mathf.Pow(r.magnitude, 1.6f) * r.normalized;
force = Vector3.ClampMagnitude(force, 14f * m2);
body.rigidBody.AddForce(force, ForceMode.Force);
}
示例3: SpawnFish
public List<Fish> SpawnFish(Entity fluid)
{
List<Fish> fishes = new List<Fish>();
Vector3 scale = fluid.Scale();
float volume = scale.x * scale.y * scale.z;
float density = 1.5f / 125000f;
float max = 100;
float num = Mathf.Min(volume * density, max) * Random.value;
for (int i = 1; i <= num; i++)
{
Vector3 offset = Vector3.Scale(Util.RandomVector(), scale/2);
Vector3 pos = fluid.Position() + offset;
float sizeMin = 0.5f;
float sizeMax = Mathf.Pow(volume, 0.25f);
float x = Random.value;
float y = Random.value;
Vector3 size = (sizeMin + 1f / (1f/sizeMax + x*y)) * Util.RandomVector(1f, 1.5f);
Fish fish = new Fish(pos, size);
fish.currentFluid = fluid.Component<Fluid>();
fishes.Add(fish);
}
return fishes;
}
示例4: UseCharacter
public Entity UseCharacter(string c)
{
lastCharacter = character;
if (c == "Dolphin")
{
character = dolphin;
}
else if (c == "Mekka")
{
character = mekka;
}
if (lastCharacter != character)
{
// Update character state
character.Position(lastCharacter.Position());
character.Velocity(lastCharacter.Velocity());
character.Rotation(lastCharacter.Rotation());
// Hide and disable old character
lastCharacter.gameObject.SetActive(false);
lastCharacter.spiritMeter.HideMeter();
// Show and enable new character
character.gameObject.SetActive(true);
// Enable gravity
if (character is Mekka)
character.Fall();
}
return character;
}