Beispiel #1
0
    public void Update()
    {
        if (PlayingAndEnabled)
        {
            if (UnityEngine.Input.GetButtonDown(Input.SelectButton))
            {
                if (Scoreboard)
                {
                    Scoreboard.Activate();
                }
            }
            if (UnityEngine.Input.GetButtonUp(Input.SelectButton))
            {
                if (Scoreboard)
                {
                    Scoreboard.DeActivate();
                }
            }

            if (UnityEngine.Input.GetButtonDown(Input.AButton))
            {
                //if(Scoreboard)
                //{
                //    ScoreboardManager.Scoreboard.SetScore(gameObject.name, "asd", 10);
                //}
            }
        }
    }
Beispiel #2
0
        /// <summary>
        /// This function will Register any objects that should be registered when used by a reflex.
        ///
        /// This is used by things like the scores and GUI buttons which only appear onscreen
        /// when used in an actor's kode.
        /// </summary>
        internal void RegisterReflexSupportedObject()
        {
            for (int i = 0; i < tasks.Count; ++i)
            {
                Task task = tasks[i];

                for (int j = 0; j < task.reflexes.Count; ++j)
                {
                    Reflex reflex = task.reflexes[j] as Reflex;

                    //Register Score Bucket
                    if (reflex.Actuator != null && reflex.Actuator.Categories.Get((int)BrainCategories.DoSetScore))
                    {
                        ScoreBucket bucket = Modifier.ScoreBucketFromModifierSet(reflex.Modifiers);
                        if (bucket != ScoreBucket.NotApplicable)
                        {
                            Scoreboard.Activate(bucket);
                        }
                    }

                    //Register Color Touch Button
                    foreach (Filter filter in reflex.Filters)
                    {
                        if (filter is GUIButtonFilter)
                        {
                            Classification.Colors eColor = (filter as GUIButtonFilter).color;

                            if (eColor >= (Classification.Colors)Classification.ColorInfo.First &&
                                eColor <= (Classification.Colors)Classification.ColorInfo.Last)
                            {
                                Debug.Assert(null != GUIButtonManager.GetButton(eColor));
                                GUIButtonManager.GetButton(eColor).Active = true;
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
    public virtual void OnPlayerDeath(int PlayerID)
    {
        foreach (Player player in Players)
        {
            if (player.PlayingAndEnabled)
            {
                if (player.PlayerNumber == PlayerID)
                {
                    player.Lives--;
                    if (player.Lives <= 0)
                    {
                        m_PlayersLeft--;
                        //print("bPlayers Left = " + m_PlayersLeft);
                        player.PlayingAndEnabled = false;
                        player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                    }
                    else
                    {
                        player.GetComponent <Transform>().position = PlayerSpawner.GetFreeSpawnPos().position;
                        Vector3 LookAt = new Vector3(0, player.transform.position.y, 0);
                        player.transform.LookAt(LookAt);
                    }
                }
            }
        }

        if (m_PlayersLeft == 1)
        {
            m_RoundInProgress = false;
            foreach (Player player in Players)
            {
                if (player.PlayingAndEnabled)
                {
                    WinningPlayer = player;
                    //WinningPlayer.DisablePlay();
                    player.GetComponent <HoverCarControl>().BearCamera.depth = 100;
                    player.GetComponent <Transform>().position = new Vector3(0, -0.5f, 0);
                    player.GetComponent <Transform>().rotation = Quaternion.Euler(Vector3.zero);
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.DORect(new Rect(0, 0, 1, 1), 1.0f);
                    WinningPlayer.PlayingAndEnabled = false;
                    WinningPlayer.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                    WinningPlayer.GetComponent <Animator>().Play("Idle");
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().enabled            = false;
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().transform.position = WinningPlayer.transform.position + WinningPlayer.transform.forward * 5.0f + (Vector3.up * 2.0f);
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().transform.DOLookAt(WinningPlayer.transform.position, 1.0f);

                    Scoreboard scoreboard = WinningPlayer.GetComponent <Player>().Scoreboard;
                    if (WinningPlayer.GetComponent <Player>().Scoreboard)
                    {
                        if (scoreboard)
                        {
                            ScoreboardManager.Scoreboard.SetScore(WinningPlayer.gameObject.name, "asd", 10);


                            if (m_Rounds == 1)
                            {
                                scoreboard.Activate();
                            }
                            //if(scoreboard.Score >= 500)
                            //{
                            //    OnArenaExit();
                            //}
                        }
                    }
                    //player.GetComponent<PlayerAnimator>().StartRotateCameraAroundPlayer();
                    return;
                }
            }
        }
    }