Ejemplo n.º 1
0
 public void LibererDelivrer(NodeController node)
 {
     node.status = NodeController.Status.idle;
     unavailableHosts.Remove(node);
     availableHosts.Add(node);
     node.ChangeColor(new Color(1.0f, 1.0f, 1.0f, 1.0f));
 }
Ejemplo n.º 2
0
    public bool Update(bool gameIsOver)
    {
        if (!gameIsOver)
        {
            if (timer_dialog > 0 && status == Status.inCall && !isInfinite)
            {
                timer_dialog -= Time.deltaTime;
                if (timer_dialog <= 0 && randomCountDown > 3.0f && !gameManager.pause)//si on doit lancer un dialogue et qu'on aura le temps de la play entier
                {
                    gameManager.soundManager.PlaySound(SoundManager.SoundList.DIALOG);
                    timer_dialog = 5.0f;
                }
            }

            if (!isInfinite)
            {
                randomCountDown -= Time.deltaTime;
            }

            if (randomCountDown < 0.0f)
            {
                gameManager.EndCall(this);
                if (!gameManager.gameIsOver)
                {
                    caller.DisplayMessageBox(false);
                    gameManager.LibererDelivrer(caller);
                    gameManager.LibererDelivrer(reciever);
                    if (node_obligatory != null)
                    {
                        node_obligatory.ChangeColor(new Color(1.0f, 1.0f, 1.0f, 1.0f));
                        node_obligatory.call   = null;
                        node_obligatory.isUsed = false;
                    }
                }

                //Debug.Log(randomCountDown);
                caller.UpdateTimer(randomCountDown);
                return(true);

                /*if(status == Status.inCall)
                 * {
                 *     gameManager.LibererDelivrer(caller);
                 *     gameManager.LibererDelivrer(reciever);
                 *     gameManager.EndCall(true);
                 *     return true;
                 * }
                 * else if (status == Status.calling || status == Status.interruptedCall)
                 * {
                 *     gameManager.LibererDelivrer(caller);
                 *     gameManager.LibererDelivrer(reciever);
                 *     gameManager.EndCall(false);
                 *     return true;
                 * }
                 */
            }
            else
            {
                if (gameManager.ActualSource() == caller)
                {
                    if (node_obligatory != null && !node_obligatory.isUsed)
                    {
                        if (status == Status.interruptedCall)
                        {
                            HaloManager(node_obligatory, Color.red);
                        }
                        else
                        {
                            HaloManager(node_obligatory, Color.white);
                        }
                    }
                    else
                    {
                        if (status == Status.interruptedCall)
                        {
                            HaloManager(reciever, Color.red);
                        }
                        else
                        {
                            HaloManager(reciever, Color.white);
                        }
                    }
                    caller.DisplayMessageBox(false);
                }
                else if (gameManager.ActualSource() == reciever)
                {
                    if (node_obligatory != null && !node_obligatory.isUsed)
                    {
                        if (status == Status.interruptedCall)
                        {
                            HaloManager(node_obligatory, Color.red);
                        }
                        else
                        {
                            HaloManager(node_obligatory, Color.white);
                        }
                    }
                    else
                    {
                        if (status == Status.interruptedCall)
                        {
                            HaloManager(caller, Color.red);
                        }
                        else
                        {
                            HaloManager(caller, Color.white);
                        }
                    }
                    caller.DisplayMessageBox(false);
                }
                else if (status == Status.calling || status == Status.interruptedCall)
                {
                    caller.DisplayMessageBox(true);
                    if (status == Status.interruptedCall)
                    {
                        HaloManager(caller, Color.red);
                    }
                    else
                    {
                        HaloManager(caller, Color.white);
                    }
                }
            }
            //Debug.Log(randomCountDown);
            caller.UpdateTimer(randomCountDown);
        }
        else
        {
            caller.UpdateTimer(0);
        }
        return(false);
    }
Ejemplo n.º 3
0
 public void SetCurrentNode(NodeController newNode)
 {
     currentNode = newNode;
     currentNode.ChangeColor(colorHost);
 }