Ejemplo n.º 1
0
        public virtual void Grow()
        {
            if (!isPlanted)
            {
                return;
            }
            if (map.CheckPlant(transform.position, true))
            {
                currentValue = currentValue.AddClamped(model.AsBodyPart().Growth, 0f, model.AsBodyPart().Max);
            }
            else
            {
            }

            for (int i = 0; i < GrowingLimbs.Length; i++)
            {
                if (i >= (int)currentValue - 1)
                {
                    break;
                }
                GrowingLimbs[i].SetActive(true);
            }

            daysPlanted++;

            if (daysPlanted >= model.AsBodyPart().Days)
            {
                CheckGrowth();
            }
        }
Ejemplo n.º 2
0
 public override void Use(GrabbableObject o)
 {
     if (!o.GetType().IsSubclassOf(typeof(BodyPart)) || ((BodyPart)o).IsPlanted || currentValue == maxValue)
     {
         return;
     }
     sfx.PlayAudio(sfx.Blend);
     currentValue = currentValue.AddClamped(o.AsBodyPart().Value, 0f, maxValue);
     RefreshBlenderFill();
     Destroy(o.gameObject);
 }
Ejemplo n.º 3
0
        IEnumerator SpawnForce(GameObject g)
        {
            Vector2 r = new Vector2(Random.Range(-.1f, .1f), Random.Range(-.1f, .1f));
            float   d = 0.2f;
            float   t = 0f;

            while (t < 1f)
            {
                t = t.AddClamped(Time.deltaTime / d, 0f, 1f);

                g.transform.position += r.xyz() * (1f - t);
                yield return(0);
            }

            yield return(0f);
        }
Ejemplo n.º 4
0
        IEnumerator Falling(Vector2 movement)
        {
            float   duration = 0.5f;
            float   t        = 0f;
            Vector2 velocity = (movement + (transform.position.xy() - playerRB.position)).normalized / 20f;
            float   rotMod   = Random.Range(-1f, 1f);

            while (t < 1f)
            {
                t = t.AddClamped(Time.deltaTime / duration, 0f, 1f);
                transform.eulerAngles += new Vector3(0f, 0f, rotMod * velocity.x * 100f * (1f - t));
                transform.position    += velocity.xyz() * (1f - t);
                yield return(0f);
            }

            yield return(0f);
        }