Esempio n. 1
0
        IEnumerator getNumberRoutine()
        {
            isInLaunch = true;
            WaitForEndOfFrame wait       = new WaitForEndOfFrame();
            float             angularVel = 1f;

            do
            {
                yield return(wait);

                angularVel = rigid.angularVelocity.magnitude;
            } while (angularVel > 0.01f);
            number = pickNumber();
            Debug.Log("dice stopped : picking a number : " + number);
            DiceZone zone = getZone();

            GameManager.Events.Trigger(new Evt.DicePickNumber(this, number, zone));
            if (zone != null)
            {
                if (audioGroundedZone != null)
                {
                    audioGroundedZone.trigger(gameObject);
                }
            }
            else
            {
                if (audioGrounded != null)
                {
                    audioGrounded.trigger(gameObject);
                }
            }

            stopLaunch();
        }
Esempio n. 2
0
        public override void onDiceLaunched(DiceInteractable dice, int number, DiceZone zone = null)
        {
            base.onDiceLaunched(dice, number);
            switch (dice.diceType)
            {
            case DiceInteractable.DICE_TYPE.NONE:
                break;

            case DiceInteractable.DICE_TYPE.MOVE_FORWARD:
                StartCoroutine(routineMove(number));
                break;

            case DiceInteractable.DICE_TYPE.TURN_LEFT:
                StartCoroutine(routineTurn(number, -1));
                break;

            case DiceInteractable.DICE_TYPE.TURN_RIGHT:
                StartCoroutine(routineTurn(number, 1));
                break;

            case DiceInteractable.DICE_TYPE.BRAKE:
                break;

            case DiceInteractable.DICE_TYPE.JUMP:
                break;

            case DiceInteractable.DICE_TYPE.SHOOT:
                break;

            default:
                break;
            }
        }
Esempio n. 3
0
        void OnTriggerExit(Collider other)
        {
            DiceZone zone = other.GetComponent <DiceZone>();

            if (zone != null)
            {
                if (currentZones.Contains(zone))
                {
                    currentZones.Remove(zone);
                    if (audioZoneExit != null)
                    {
                        audioZoneExit.trigger(gameObject);
                    }
                }
            }
        }
Esempio n. 4
0
        void OnTriggerEnter(Collider other)
        {
            DiceZone zone = other.GetComponent <DiceZone>();

            if (zone != null)
            {
                if (!currentZones.Contains(zone))
                {
                    currentZones.Add(zone);
                    if (audioZoneEnter != null)
                    {
                        audioZoneEnter.trigger(gameObject);
                    }
                }
            }
        }
Esempio n. 5
0
 public virtual void onDiceLaunched(DiceInteractable dice, int number, DiceZone zone = null)
 {
 }