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


C# Sprite.SetRotation方法代码示例

本文整理汇总了C#中Sprite.SetRotation方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.SetRotation方法的具体用法?C# Sprite.SetRotation怎么用?C# Sprite.SetRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sprite的用法示例。


在下文中一共展示了Sprite.SetRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddExplosion

    // Add an explosion into the list (will remove self once complete)
    public void AddExplosion(Vector2 Position)
    {
        // Allocate and register the new sprite, starting with the explosion
        // Note: slight randomization to add effect
        Sprite Explosion = new Sprite("Textures/ExplosionSprite" + UnityEngine.Random.Range(0, 2)); // [0, 1]
        Explosion.SetPosition(Position);
        Explosion.SetAnimation(Vector2.zero, new Vector2(20, 20), 7, 0.06f + UnityEngine.Random.Range(-0.01f, 0.05f));
        Explosion.SetGeometrySize(Explosion.GetSpriteSize() * (0.6f + UnityEngine.Random.Range(-0.2f, 0.2f)));
        Explosion.SetRotationCenter(Explosion.GetGeometrySize() / UnityEngine.Random.Range (1.0f, 2.0f));
        Explosion.SetRotation(UnityEngine.Random.Range(0.0f, 2.0f * Mathf.PI));
        Explosion.SetDepth(Globals.ExplosionDepth);

        // Register to renderer and list
        Globals.WorldView.SManager.AddSprite(Explosion);
        Explosions.Add(Explosion);

        // Add explosion audio
        int Index = UnityEngine.Random.Range(1, 4); // [1, 4)
        Globals.WorldView.AManager.PlayAudio(Position, "Explosion" + Index);
    }
开发者ID:nint22,项目名称:NovaLegacy,代码行数:21,代码来源:ProjectileManager.cs

示例2: AddGlow

    // Add glow ontop of what is being fired
    public void AddGlow(Vector2 Position)
    {
        // Sprite info
        Vector2 GlowPos = ProjectileInfo.GetKey_Vector2("Glow", "Pos");
        Vector2 GlowSize = ProjectileInfo.GetKey_Vector2("Glow", "Size");

        // Allocate and register the new sprite
        // Note: slight randomization to add effect
        Sprite Explosion = new Sprite("Textures/Projectiles");
        Explosion.SetAnimation(GlowPos, GlowSize, 1, 1.0f);

        // Set in-world properties
        Explosion.SetPosition(Position);
        Explosion.SetGeometrySize(Explosion.GetSpriteSize() * (0.6f + UnityEngine.Random.Range(-0.2f, 0.2f)));
        Explosion.SetRotationCenter(Explosion.GetGeometrySize() / 2.0f);
        Explosion.SetRotation(UnityEngine.Random.Range(0.0f, 2.0f * Mathf.PI));
        Explosion.SetDepth(Globals.ExplosionDepth);

        // Register to renderer and list
        Globals.WorldView.SManager.AddSprite(Explosion);
        Glow.Add(Explosion);
    }
开发者ID:nint22,项目名称:NovaLegacy,代码行数:23,代码来源:ProjectileManager.cs


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