Exemple #1
0
    void Start()
    {
        win       = GameObject.Find("Win");
        shake     = Camera.main.GetComponent <CameraShake>();
        announce  = GameObject.Find("State Text").GetComponent <Text>();
        announce2 = GameObject.Find("State Text2").GetComponent <Text>();
        win.SetActive(false);
        if (InstanceFourPlayer != null)
        {
            Destroy(InstanceFourPlayer.gameObject);
        }
        InstanceFourPlayer = this;

        DontDestroyOnLoad(gameObject);

        vegans     = 2;
        carnivores = 2;
        PrepareArray();

        colorsArray = pM[0].gameObject.GetComponent <IndicatorController>().colors;
        for (int i = 0; i < texts.Length; i++)
        {
            texts[i].color = colorsArray[i];
        }
        UpdatetScores();
        StartCoroutine(StartRound());
    }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player") && other.gameObject.GetComponent <PlayerMove> ().isVegan != isVegan)
        {
            FourPlayerM manager = FindObjectOfType <FourPlayerM> ();
            //if (!manager)
            // Two player manager
            PlayerMove player = other.gameObject.GetComponent <PlayerMove> ();

            if (player.isVegan)
            {
                AudioManager.instance.Play("hit_vegan");
                GameObject g = Instantiate(bonesPS, other.transform.position, Quaternion.identity);
                Destroy(g, 2);
            }
            else
            {
                AudioManager.instance.Play("hit_carnist");
                GameObject g = Instantiate(flowersPS, other.transform.position, Quaternion.identity);
                Destroy(g, 2);
            }

            if (manager != null)
            {
                manager.ManageHit(playerId, int.Parse(player.id), isVegan);
            }

            Die();
        }
    }