Ejemplo n.º 1
0
    public void ShowParticleBurst(float startX, float startY, int count, string elementName, float startScale, float endScale, params Color[] colors)
    {
        FParticleDefinition pd = new FParticleDefinition(elementName);

        pd.x          = startX;
        pd.y          = startY;
        pd.startScale = startScale;
        pd.endScale   = endScale;

        //somewhat evenly spread the particles in a circle

        float radiansPerParticle = RXMath.DOUBLE_PI / (float)count;
        float nextAngle          = 0.0f;

        for (int c = 0; c < count; c++)
        {
            pd.lifetime = RXRandom.Range(0.3f, 0.5f);

            float speed    = RXRandom.Range(30.0f, 80.0f);
            float useAngle = nextAngle + RXRandom.Range(-0.01f, 0.01f);

            pd.speedX = Mathf.Cos(useAngle) * speed;
            pd.speedY = Mathf.Sin(useAngle) * speed;

            nextAngle += radiansPerParticle;

            pd.startColor = RXRandom.GetRandomItem(colors);
            pd.endColor   = RXRandom.GetRandomItem(colors).CloneWithNewAlpha(0.0f);

            particleSystem.AddParticle(pd);
        }
    }
Ejemplo n.º 2
0
    override public void Start()
    {
        var startPos = RXRandom.GetRandomItem(arena.mapData.startPoses) as StartPosMI;

        arena.mapData.startPoses.Remove(startPos);

        Vector2 center = new Vector2(startPos.x, startPos.y);

        human = new Human(this, arena.entityArea, false);
        human.SetPosition(center);
        human.AddToArea();
        arena.humans.Add(human);
    }
Ejemplo n.º 3
0
    override public void Start()
    {
        var startPos = RXRandom.GetRandomItem(arena.mapData.startPoses) as StartPosMI;

        arena.mapData.startPoses.Remove(startPos);

        Vector2 center   = new Vector2(startPos.x, startPos.y);
        float   radius   = 40;
        int     failsafe = 0;

        while (vills.Count < initialVillCount && failsafe++ < 1000)
        {
            Vector2 checkPos = center + (RXRandom.Vector2Normalized() * radius * RXRandom.Float());
            if (!arena.entityArea.CheckPointHit(checkPos.x, checkPos.y))
            {
                Vill vill = new Vill(this, arena.entityArea);
                vill.SetPosition(checkPos);
                vill.AddToArea();
                vills.Add(vill);
                arena.vills.Add(vill);
            }
        }
    }