Esempio n. 1
0
        public override void OnAwake()
        {
            holdLoop = Media.SoundChainsawLoop;
            holdLoop.Play();
            holdLoop.Loop   = true;
            holdLoop.Volume = 0f;

            // Values
            const int    EDGES              = 12;
            const double EDGE_LENGTH        = .4;
            const double EDGE_INNER_PERCENT = .65;

            // Add shape outline renderer
            renderer        = GameObject.AddComponent <ShapeOutlineRenderer>();
            collider        = GameObject.AddComponent <CircleCollider>();
            collider.Radius = (float)EDGE_LENGTH;

            // Create blade shape
            Vector2[] points = new Vector2[EDGES * 2];
            for (int i = 0; i < EDGES * 2; i += 2)
            {
                points[i]     = Vector2.FromAngle((i / (float)EDGES) * 360) * EDGE_LENGTH;
                points[i + 1] = Vector2.FromAngle((i / (float)EDGES) * 360) * EDGE_LENGTH * EDGE_INNER_PERCENT;
            }
            renderer.SetPoints(points);

            // Render layer and color
            renderer.RenderLayer = Render.DEFAULT_RENDER_LAYER + 50;
            renderer.MainColor   = new Color(160, 160, 160);
        }
Esempio n. 2
0
        public override void OnStart()
        {
            Vector2[] points = new Vector2[]
            {
                new Vector2(SRandom.Range(0, .2), SRandom.Range(0, .2)),
                new Vector2(SRandom.Range(-.2, .2), SRandom.Range(-.2, 0)),
                new Vector2(SRandom.Range(-.2, 0), SRandom.Range(-.2, .2))
            };

            renderer.SetPoints(points);
            renderer.MainColor   = color;
            renderer.RenderLayer = layer;

            velocity = new Vector2(SRandom.Range(-.15, .15), SRandom.Range(-.1, .3));
        }