Example #1
0
    public virtual void Reset(Vector2 position, Quaternion rotation, float velocity, float flightTime, bool isshotgun)
    {
        this.flightTime           = flightTime;
        transform.position        = position;
        transform.rotation        = rotation;
        rigidBody.velocity        = transform.right * velocity;
        rigidBody.angularVelocity = 0.0f;
        transform.parent          = null;
        IsShotgunProjectile       = isshotgun;

        if (MyTrailRenderer)
        {
            MyTrailRenderer.Clear();
        }
        if (MyShotgunTrailRenderer)
        {
            MyShotgunTrailRenderer.Clear();
        }
        if (IsShotgunProjectile)
        {
            if (MyTrailRenderer)
            {
                MyTrailRenderer.enabled = false;
            }
            if (MyLineRenderer)
            {
                MyLineRenderer.enabled = false;
            }
            if (MyShotgunTrailRenderer)
            {
                MyShotgunTrailRenderer.enabled = false;
            }
            if (MyShotgunLineRenderer)
            {
                MyShotgunLineRenderer.enabled = false;
            }
        }
        else
        {
            if (MyTrailRenderer)
            {
                MyTrailRenderer.enabled = true;
            }
            if (MyLineRenderer)
            {
                MyLineRenderer.enabled = true;
            }
            if (MyShotgunTrailRenderer)
            {
                MyShotgunTrailRenderer.enabled = false;
            }
            if (MyShotgunLineRenderer)
            {
                MyShotgunLineRenderer.enabled = false;
            }
        }
        Live = true;
    }
Example #2
0
 private void Awake()
 {
     poolLink           = GetComponent <PooledObject>();
     rigidBody          = GetComponent <Rigidbody2D>();
     projectileCollider = GetComponent <Collider2D>();
     if (MyTrailRenderer)
     {
         MyTrailRenderer.Clear();
     }
     if (MyShotgunTrailRenderer)
     {
         MyShotgunTrailRenderer.Clear();
     }
 }