Пример #1
0
        IEnumerator SummonShip()
        {
            Active = false;
            Alive  = false;
            foreach (var a in animators)
            {
                a.SetTrigger("Stop");
            }
            foreach (var r in Renderers)
            {
                r.flipX = false;
            }
            Camera = false;

            ShipScript ship = GameObject.Find("Ship").GetComponent <ShipScript>();

            ship.NewCollectionPoint(new Vector3(transform.position.x + 1.44f, transform.position.y + 6.917f, -20), gameObject);

            var player = Controller.NextPlayer();

            foreach (var pl in Controller.Players)
            {
                pl.FollowScript.SetTarget(null);
            }

            if (Controller.Players.Any(p => p.Alive))
            {
                while (!player.Alive)
                {
                    player = Controller.NextPlayer();
                }
                player.Activate();
                player.Camera = true;
            }
            else
            {
                GameObject.Find("Main Camera").GetComponent <CameraScript>().ChangePlayer(null);
                ship.Pickup();
                enabled = false;
                yield return(0);
            }

            FollowScript.enabled = false;

            GameObject.Find("Main Camera").GetComponent <CameraScript>().ChangePlayer(player);

            enabled = false;

            yield return(0);
        }
Пример #2
0
        bool CheckForGameOver()
        {
            if (!Controller.Players.Any(p => p.Alive))
            {
                // UH OH! Game over
                if (Controller.Players.Any(p => p.Complete))
                {
                    Debug.Log("Completed");
                    ShipScript ship = GameObject.Find("Ship").GetComponent <ShipScript>();
                    GameObject.Find("Main Camera").GetComponent <CameraScript>().ChangePlayer(null);
                    ship.Pickup();
                    enabled = false;
                }
                else
                {
                    GameObject.Find("GameController").GetComponent <GameControllerScript>().LevelFailedPopup.SetActive(true);
                }

                StatusImage.sprite = StatusImages[2];
                return(false);
            }
            return(true);
        }