Esempio n. 1
0
    public void OnMouseUpAsButton()
    {
        if (!isActive && GameManager.i.state == GameManager.State.Menu)
        {
            GameManager.i.NewPlayerAvailable(this);

            //pick a random enum val from Colors
            var values = Enum.GetValues(typeof(C.Colors));
            int rand = UnityEngine.Random.Range(0,3);
            //Don't blame me, blame Unity
            switch (rand)
            {
                case 0: { buttonColor = C.Colors.Blue; break; }
                case 1: { buttonColor = C.Colors.Green; break; }
                case 2: { buttonColor = C.Colors.Red; break; }
                case 3: { buttonColor = C.Colors.White; break; }
                case 4: { buttonColor = C.Colors.Yellow; break; }
            }
            //Debug.Log("random: "+ rand+" color: "+ buttonColor);
            EnableButton();
        }

        if (isActive && GameManager.i.state == GameManager.State.Game)
        {
            if(runner != null)
                runner.RunnerAction();
        }
    }
Esempio n. 2
0
 private void SyncRunnerColor( RunnerController rc )
 {
     if (runner != null && runner == rc)
     {
         buttonColor = rc.CurrentColor;
         EnabledSprite.color = C.GetRealColor(buttonColor);
     }
 }
Esempio n. 3
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     //Debug.Log("Before collision Color is : " + currColor.ToString());
     currColor = collider.gameObject.GetComponent<GemController>().MyColor;
     EventManager.RaiseRunnerChangedColor(this);
     //Debug.Log("After collision Color is : " + currColor.ToString());
 }