Ejemplo n.º 1
0
 public void DrawBlood(Vector2 direction)
 {
     for (int i = 0; i < intensity_; i++)
     {
         // get random angle
         Vector2 new_vector = Random.Range(0, 2) == 0 ? GF.RotateVector(direction, Random.Range(0.0f, angle_range_)).normalized :
                              GF.RotateVector(direction, Random.Range(0.0f, -angle_range_)).normalized;
         if (blood_ != null)
         {
             GameObject temp = Instantiate(blood_, new Vector3(transform.position.x, transform.position.y, 0.0f), Quaternion.identity);
             temp.GetComponent <Rigidbody2D>().AddForce(new_vector * Random.Range(splatter_upper_lower.x, splatter_upper_lower.y), ForceMode2D.Impulse);
         }
     }
 }
Ejemplo n.º 2
0
    void Suck()
    {
        if (sucking_counter_ < sucking_duration_)
        {
            sucking_counter_ += Time.deltaTime;

            // randomly spawn particles in a circular radius
            for (int i = 0; i < particle_amt_; i++)
            {
                // get random coordinate
                Vector2 random = GF.RotateVector(new Vector2(1.0f, 0.0f), Random.RandomRange(0.0f, 360.0f));
                if (particle_ != null)
                {
                    GameObject temp = Instantiate(particle_);
                    temp.GetComponent <GolemParticle>().Init(transform);
                    temp.transform.position = (Vector2)gameObject.transform.position + random * radius_;
                }
            }
        }
        else
        {
            sucking_ = false;
        }
    }