当前位置: 首页>>代码示例>>C#>>正文


C# Entity.Position方法代码示例

本文整理汇总了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();
 }
开发者ID:qualiabyte,项目名称:mukei-dolphin,代码行数:7,代码来源:CubeField.cs

示例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);
 }
开发者ID:qualiabyte,项目名称:mukei-dolphin,代码行数:10,代码来源:Planet.cs

示例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;
 }
开发者ID:qualiabyte,项目名称:mukei-dolphin,代码行数:23,代码来源:TutorialScene.cs

示例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;
    }
开发者ID:qualiabyte,项目名称:mukei-dolphin,代码行数:34,代码来源:Player.cs


注:本文中的Entity.Position方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。