示例#1
0
    void Start()
    {
        rb = GetComponent <Rigidbody2D>();

        rb.isKinematic = false;
        mass           = rb.mass;
        rb.isKinematic = true;

        animator         = GetComponent <Animator>();
        audio_controller = transform.GetChild(1).gameObject.GetComponent <Audio_controller>();
        telomere         = GetComponent <Telomere>();
    }
示例#2
0
    void Start()
    {
        front = transform.GetChild(0).gameObject.GetComponent <ParticleSystem>();
        trace = transform.GetChild(1).gameObject.GetComponent <ParticleSystem>();
        dust  = transform.GetChild(2).gameObject.GetComponent <ParticleSystem>();

        Sprite source_metor = transform.parent.gameObject.GetComponent <SpriteRenderer>().sprite;

        float mass = transform.parent.gameObject.GetComponent <Meteor_damage>().mass;

        Vector3 parent_scale = transform.parent.localScale;

        var front_shape = front.shape;

        front_shape.sprite    = source_metor;
        front_shape.scale     = parent_scale;
        front_shape.rotation -= transform.localEulerAngles;

        var front_emission = front.emission;

        front_emission.rateOverTime = new ParticleSystem.MinMaxCurve(mass * front_emission.rateOverTime.constantMax);


        var dust_shape = dust.shape;

        dust_shape.sprite    = source_metor;
        dust_shape.scale     = parent_scale;
        dust_shape.rotation -= transform.localEulerAngles;

        var dust_emission = dust.emission;

        dust_emission.rateOverTime = new ParticleSystem.MinMaxCurve(mass * dust_emission.rateOverTime.constantMax);


        telomere = transform.parent.gameObject.GetComponent <Telomere>();

        default_direction = transform.eulerAngles;
    }