Esempio n. 1
0
    public bool Grow(SpiritBase.SpiritType type)
    {
        if (colliderAdd0.activeSelf)
        {
            if (colliderAdd1.activeSelf)
            {

                // Already grown, grow next or prev
                StoneGrower canGrow = NearestCanGrow();

                if (canGrow)
                {
                    canGrow.Grow(type);
                    return true;
                }
                return false;
            }

            colliderAdd1.SetActive(true);
        }
        else
        {
            colliderAdd0.SetActive(true);
            colliderAdd1.SetActive(true);

            IGrowAndShrinkAnimation[] children = GetComponentsInChildren<IGrowAndShrinkAnimation>();
            foreach(IGrowAndShrinkAnimation anim in children)
            {
                anim.Grow(type);
            }
        }

        return true;
    }
Esempio n. 2
0
    public void Grow(SpiritBase.SpiritType type)
    {
        Sprite sprite = null;
        switch(type)
        {
            case SpiritBase.SpiritType.Fire:
                sprite = fire;
                break;
            case SpiritBase.SpiritType.Air:
                sprite = air;
                break;
            case SpiritBase.SpiritType.Water:
                sprite = water;
                break;
            case SpiritBase.SpiritType.Earth:
                sprite = earth;
                break;
            default:
                sprite = fire;
                break;
        }

        this.sprite.sprite = sprite;

        AnimatedGrow();
    }
Esempio n. 3
0
    public void Grow(SpiritBase.SpiritType type)
    {
        float startTime = Time.time;
        Do(() =>
        {
            if (Time.time - startTime < wait)
                return true;

            GetComponent<SpriteRenderer>().color = Color.clear;
            return false;
        });
    }
 public static void Clean(SpiritBase.SpiritType type)
 {
     switch(type)
     {
         case SpiritBase.SpiritType.Fire:
             me.fire.Play();
             break;
         case SpiritBase.SpiritType.Air:
             me.air.Play();
             break;
         case SpiritBase.SpiritType.Water:
             me.water.Play();
             break;
         case SpiritBase.SpiritType.Earth:
             me.earth.Play();
             break;
     }
 }
Esempio n. 5
0
    IEnumerator Particles(SpiritBase spirit)
    {
        GameObject particles;
        GameObject target;
        Vector3 startPos = new Vector3(0, 0, 0);
        float time = Time.time;
        switch (spirit.type)
        {
            case SpiritBase.SpiritType.Fire:
                particles = fireParticles;
                target = fireBar;
                break;
            case SpiritBase.SpiritType.Air:
                particles = airParticles;
                target = airBar;
                break;
            case SpiritBase.SpiritType.Earth:
                particles = earthParticles;
                target = earthBar;
                break;
            case SpiritBase.SpiritType.Water:
                particles = waterParticles;
                target = waterBar;
                break;
            default:
                particles = null;
                target = null;
                break;
        }

       var particleObject =  Instantiate(particles, gameObject.transform.position, Quaternion.identity) as GameObject;
        particleObject.GetComponent<ParticleSystem>().startSize *= 0.3f;
        particleObject.GetComponent<ParticleSystem>().Stop();
        AudioManager.PlaySound("FX/Gameplay/Spirits/Totem-Move", particleObject);

        while (Vector3.SqrMagnitude(target.transform.position - particleObject.transform.position) >= 5)
        {
            particleObject.transform.position = Vector3.Lerp(startPos, target.transform.position, (Time.time - time) * particleSpeedMultiplier);
            yield return null;
        }

        Destroy(particleObject);
    }