Exemplo n.º 1
0
    bool Fire(Vector3 target)
    {
        target.z = 0f;
        Lava lava = Peripheral.Instance.zoo.getObject(meteor_lava, false).GetComponent <Lava>();

        Debug.Log("making a meteor lava " + meteor_lava + " @ " + target + " size " + lava_size + "\n");

        lava.Init(EffectType.Meteor, level, stats, lava_life, true, my_firearm);
        lava.SetLocation(this.transform, target, lava_size, Quaternion.identity);
        lava.SetFactor(1f);
        lava.gameObject.SetActive(true);

        List <HitMe> targets = lava.GetVictims();

        foreach (HitMe victim in targets)
        {
            float   distance  = Vector2.Distance(target, victim.transform.position);
            float   force     = 1f + 1 / distance;
            float   mass      = victim.my_rigidbody.mass;
            Vector3 direction = (victim.transform.position - target).normalized;
            //Debug.Log("FROM " + target + );
            victim.my_rigidbody.AddForce(15f * force * mass * direction, ForceMode2D.Impulse);
            victim.my_ai.Stunned = true;
        }

        Tracker.Log(PlayerEvent.SpecialSkillUsed, true,
                    customAttributes: new Dictionary <string, string>()
        {
            { "attribute_1", EffectType.Meteor.ToString() }, { "attribute_2", target.x + "_" + target.y }
        },
                    customMetrics: new Dictionary <string, double>()
        {
            { "metric_1", level }
        });


        return(true);
    }