Esempio n. 1
0
 public bool isSelectState(FIELD_STATE field)
 {
     if (field == FIELD_STATE.NOON)
     {
         if (state != PLAYER_STATE.NOON_END)
         {
             return(true);
         }
     }
     else if (field == FIELD_STATE.NIGHT)
     {
         if (state == PLAYER_STATE.NIGHT_VOTE)
         {
             return(true);
         }
         if (state == PLAYER_STATE.NONE)
         {
             return(true);
         }
     }
     else if (field == FIELD_STATE.MIDNIGHT)
     {
         if (state == PLAYER_STATE.NONE)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
    IEnumerator WaitUntilPlant(float time)
    {
        yield return(new WaitForSeconds(time));

        Seed.SetActive(false);
        Plant.SetActive(true);
        fieldState = FIELD_STATE.PLANT;
        StartCoroutine(WaitUntilGrown(Random.Range(MinTimeToGrow, MaxTimeToGrow)));
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (isTree && fieldState == FIELD_STATE.EMPTY)
        {
            Seed.SetActive(true);
            fieldState = FIELD_STATE.SEEDED;
            StartCoroutine(WaitUntilPlant(Random.Range(MinTimeToPlant, MaxTimeToPlant)));
        }


        if (Input.GetMouseButtonDown(0))
        {
            Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            if (colliderField.OverlapPoint(mousePosition))
            {
                switch (fieldState)
                {
                case FIELD_STATE.EMPTY:
                {
                    GetComponent <AudioSource>().PlayOneShot(AudioSeed);
                    Seed.SetActive(true);
                    fieldState = FIELD_STATE.SEEDED;
                    StartCoroutine(WaitUntilPlant(Random.Range(MinTimeToPlant, MaxTimeToPlant)));
                    Debug.Log("lol");
                }
                break;

                case FIELD_STATE.RIPE:
                {
                    Plant_Grown.SetActive(false);
                    fieldState = FIELD_STATE.EMPTY;
//						Destroy(ParticleEffect);
                    GetComponent <AudioSource>().PlayOneShot(AudioHarvest);

                    GameObject EffectCollect = Instantiate(ParticleCollect) as GameObject;
                    EffectCollect.transform.parent        = ParticlesGO.transform;
                    EffectCollect.transform.rotation      = new Quaternion(0, 0, 0, 0);
                    EffectCollect.transform.localPosition = Vector3.zero;

                    IconHarvest.SetActive(true);
                    Animation anim = (Animation)IconHarvest.GetComponent("Animation");
                    anim.Play();

                    StartCoroutine(DisableIcon(1.0f));
                }
                break;

                default:
                    break;
                }
            }
        }
    }
Esempio n. 4
0
 public void sync(Field o)
 {
     timer        = o.timer;
     useKnife     = o.useKnife;
     dementDay    = o.dementDay;
     state        = o.state;
     turn         = o.turn;
     captivity    = o.captivity;
     yes          = o.yes;
     no           = o.no;
     fmid_murdere = o.fmid_murdere;
     now_time     = o.now_time;
     for (int i = 0; i < dustItems.Length; i++)
     {
         dustItems[i] = o.dustItems[i];
     }
     dustItem = o.dustItem;
 }
Esempio n. 5
0
    IEnumerator WaitUntilGrown(float time)
    {
        yield return(new WaitForSeconds(time));

        Debug.Log(time);
        Plant.SetActive(false);
        Plant_Grown.SetActive(true);

        GetComponent <AudioSource>().PlayOneShot(AudioRipe);

        GameObject EffectCollect = Instantiate(ParticleGrown) as GameObject;

        EffectCollect.transform.parent        = ParticlesGO.transform;
        EffectCollect.transform.rotation      = new Quaternion(0, 0, 0, 0);
        EffectCollect.transform.localPosition = Vector3.zero;
//
//			ParticleEffect = Instantiate(ParticleRipe) as GameObject;
//			ParticleEffect.transform.parent = ParticlesGO.transform;
//			ParticleEffect.transform.rotation = new Quaternion(0,0,0,0);
//			ParticleEffect.transform.localPosition = Vector3.zero;

        fieldState = FIELD_STATE.RIPE;
    }
Esempio n. 6
0
 // Use this for initialization
 void Start()
 {
     fieldState    = FIELD_STATE.EMPTY;
     colliderField = (CircleCollider2D)this.gameObject.GetComponent("CircleCollider2D");
 }