Ejemplo n.º 1
0
    public EffectSpark Setup(Vector3 origin, Vector3 target, float duration = -1)
    {
        spark = Instantiate(sparkSprite, transform);

        if (duration < 0)
        {
            duration = this.sparkDuration;
        }

        base.Setup(spark.transform, origin, target, duration);

        return(this);
    }
Ejemplo n.º 2
0
    public EffectLaserBolt Setup(Vector3 origin, Vector3 target)
    {
        float   dx     = target.x - origin.x;
        float   rx     = boltSprite.Width * .5f;
        Vector3 offset = Vector3.right * (Mathf.Sign(dx) * rx);

        boltOrigin   = origin + offset;
        boltTarget   = target - offset;
        sparksOrigin = target;

        bolt = Instantiate(boltSprite, transform);
        Game.Instance.audioManager.Play("laser");
        return(this);
    }
Ejemplo n.º 3
0
    public EffectTorpedoLaunch Setup(Vector3 origin, Vector3 target)
    {
        float   dx     = target.x - origin.x;
        float   rx     = torpedoSprite.Width * .5f;
        Vector3 offset = Vector3.right * (Mathf.Sign(dx) * rx);

        torpedoOrigin = origin + offset;
        torpedoTarget = target - offset;

        torpedo = Instantiate(torpedoSprite, transform);
        if (torpedoOrigin.x < torpedoTarget.x)
        {
            torpedo.GetRenderer().flipX = true;
        }

        Game.Instance.audioManager.Play("laser"); // TODO Pick a better sound
        return(this);
    }