コード例 #1
0
ファイル: Damage.cs プロジェクト: leontzh97/SurvivalShooter
 void Start()
 {
     Player          = GameObject.FindGameObjectWithTag("Player");
     GameControl     = GameObject.Find("GameControl");
     PlayerDamage    = Player.GetComponentInChildren <PlayerShooting> ();
     PowerUpsManager = GameControl.GetComponent <PowerUpsManager> ();
 }
コード例 #2
0
ファイル: Slowdown.cs プロジェクト: leontzh97/SurvivalShooter
 // Use this for initialization
 void Start()
 {
     player          = GameObject.FindGameObjectWithTag("Player");
     gamecontrol     = GameObject.Find("GameControl");
     playerMv        = player.GetComponent <PlayerMovement> ();
     powerUpsManager = gamecontrol.GetComponent <PowerUpsManager> ();
 }
コード例 #3
0
 void Start()
 {
     Player          = GameObject.FindGameObjectWithTag("Player");
     GameControl     = GameObject.Find("GameControl");
     PlayerHealth    = Player.GetComponent <PlayerHealth> ();
     PowerUpsManager = GameControl.GetComponent <PowerUpsManager> ();
 }
コード例 #4
0
ファイル: Map.cs プロジェクト: TheAnosmic/MetaLanParty0x00
 // Use this for initialization
 void Start()
 {
     factory = new EnemyFactory(gameObject);
     factory.PossibleEnemies = PossibleEnemies;
     factory.Target = Player;
     powerUpsManager = new PowerUpsManager(PowerUpPrefab);
     InvokeRepeating("Launch", 0.1f, 0.3F);
     // Create power up every 30 sec
     InvokeRepeating("CreatePrefab", 0.1f, 30F);
 }
コード例 #5
0
ファイル: Paddle.cs プロジェクト: revorr/Rozen
    public float powerUpslength;  //time of power ups active..i.e duration..\


    // Rigidbody2D rb;  public float moveInput;



    // Use this for initialization
    void Start()
    {
        // currentScale = paddleScale;
        gSession = FindObjectOfType <GameSession>();
        ball     = FindObjectOfType <BallScript>();
        resume   = FindObjectOfType <Resume>();
        //  adManager = GameObject.FindGameObjectWithTag("AdManager").GetComponent<AdManager>();

        pManager = FindObjectOfType <PowerUpsManager>();
    }
コード例 #6
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
 }
コード例 #7
0
 private void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
コード例 #8
0
    void StartGame()
    {
        SoundsManager.getInstance().PlayIngameMusic();

        PhysicalGameManager.getInstance().gameObject.transform.GetChild(0).gameObject.SetActive(false);

        if (NetworkManager.getInstance().IsServer())
        {
            ObstaclesManager.getInstance().StartObstaclesManager();
            PowerUpsManager.getInstance().StartPowerUpsManager();
        }

        for (int i = 0; i < 4; i++)
        {
            if (i == SelectedPlayer)
            {
                transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SelectPlayer(true);
            }
            else
            {
                if (!InPractice)
                {
                    transform.GetChild(3).GetChild(i).GetComponent <NPCController>().enabled = true;
                    transform.GetChild(3).GetChild(i).GetComponent <NPCController>().StartSynchronize();
                }
                transform.GetChild(3).GetChild(i).GetComponent <CapsuleCollider>().enabled = false;
                Destroy(transform.GetChild(3).GetChild(i).GetComponent <Rigidbody>());
            }
        }

        var Platforms = gameObject.GetComponentsInChildren <FixedPlatform>();

        // Enable rigidbodies:
        foreach (var component in Platforms)
        {
            component.Initiate();
        }

        UIPlayerFollow.getInstance().SetPlayer(SelectedPlayer);

        Timer.getInstance().StartTimer();

        GameCanvas.getInstance().gameObject.transform.GetChild(0).GetChild(0).GetChild(0).GetChild(SelectedPlayer).gameObject.SetActive(true);
        GameCanvas.getInstance().gameObject.transform.GetChild(0).GetChild(1).GetChild(SelectedPlayer).gameObject.SetActive(true);
        GameCanvas.getInstance().gameObject.transform.GetChild(0).GetChild(0).GetChild(1).gameObject.SetActive(true);

        InGame = true;
    }
コード例 #9
0
 private void Awake()
 {
     Instance = this;
 }
コード例 #10
0
    protected override void StringMessageReader(string msg)
    {
        string[] deltas = msg.Split('|');

        switch (deltas[0])
        {
        // ------------------------------------------------------ GAME STATUS UPDATE ------------------------------------------------------
        case "RD":
            StringMessageToClients(msg);
            int PlayerReady;
            if (Int32.TryParse(deltas[1], out PlayerReady))
            {
                GameManager.getInstance().SetPlayerReady(PlayerReady);
            }
            break;

        case "WIN":
            StringMessageToClients(msg);
            int WinnerNumb;
            if (Int32.TryParse(deltas[1], out WinnerNumb))
            {
                GameCanvas.getInstance().transform.GetChild(0).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(1).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(2).gameObject.SetActive(true);
                GameCanvas.getInstance().transform.GetChild(2).GetChild(WinnerNumb + 1).gameObject.SetActive(true);

                Time.timeScale = 0f;
            }
            break;

        // ------------------------------------------------------ PLAYERS POSITIONS UPDATE ------------------------------------------------------
        // ------------------------------------------------------ TO MODIFY, OPTIMIZE FOR 2 PLAYERS ------------------------------------------------------
        case "SBP":
            // StringMessageToClients(msg);
            NPCPlayers[0].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            break;

        case "SEP":
            // StringMessageToClients(msg);
            NPCPlayers[1].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            break;

        case "SLP":
            // StringMessageToClients(msg);
            NPCPlayers[2].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            break;

        case "SSP":
            // StringMessageToClients(msg);
            NPCPlayers[3].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            break;

        // ------------------------------------------------------ POWERS EFFECTS ------------------------------------------------------
        case "FP":
            StringMessageToClients(msg);
            int FirePowerSafePlayer;
            if (Int32.TryParse(deltas[1], out FirePowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(1).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != FirePowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetOnFire();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetOnFire();
                        }
                    }
                }
            }
            break;

        case "IP":
            StringMessageToClients(msg);
            int IcePowerSafePlayer;
            if (Int32.TryParse(deltas[1], out IcePowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(0).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != IcePowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetFrozen();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetFrozen();
                        }
                    }
                }
            }

            break;

        case "CP":
            StringMessageToClients(msg);
            int ConfusionPowerSafePlayer;
            if (Int32.TryParse(deltas[1], out ConfusionPowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(2).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);
                for (int i = 0; i < 4; i++)
                {
                    if (i != ConfusionPowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetConfused();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetConfused();
                        }
                    }
                }
            }
            break;

        case "BP":
            StringMessageToClients(msg);
            int BouncePowerSafePlayer;
            if (Int32.TryParse(deltas[1], out BouncePowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(3).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != BouncePowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetBounce();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetBounce();
                        }
                    }
                }
            }
            break;

        default:
            Debug.Log("Error - message not recognized: " + msg);
            break;
        }
    }
コード例 #11
0
 // Start is called before the first frame update
 void Start()
 {
     thePowerUpsManager = FindObjectOfType <PowerUpsManager>();
 }
コード例 #12
0
    protected override void StringMessageReader(string msg)
    {
        string[] deltas = msg.Split('|');

        switch (deltas[0])
        {
        // ------------------------------------------------------ GAME STATUS UPDATE ------------------------------------------------------
        case "PN":
            int ToSetID;
            if (Int32.TryParse(deltas[1], out ToSetID))
            {
                PlayerNumber = ToSetID;
                ConnectionManager.getInstance().Connected();
                IPAddressText.text = "Waiting for players...\n[IP: " + deltas[2] + "]";
            }
            break;

        case "CN":
            int PlayerNumb;
            if (Int32.TryParse(deltas[1], out PlayerNumb))
            {
                ConnectionManager.getInstance().ConnectedPlayer(PlayerNumb);
            }
            break;

        case "ST":
            DontDestroyOnLoad(gameObject);
            SceneManager.LoadScene("Game Scene");
            SoundsManager.getInstance().StopAllSounds();
            Invoke("ActivatePlayer", 1.5f);
            break;

        case "RD":
            int PlayerReady;
            if (Int32.TryParse(deltas[1], out PlayerReady))
            {
                GameManager.getInstance().SetPlayerReady(PlayerReady);
            }
            break;

        case "PC":
            PlatformManager.getInstance().SetConfiguration(deltas);
            break;

        case "WIN":
            int WinnerNumb;
            if (Int32.TryParse(deltas[1], out WinnerNumb))
            {
                GameCanvas.getInstance().transform.GetChild(0).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(1).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(2).gameObject.SetActive(true);
                GameCanvas.getInstance().transform.GetChild(2).GetChild(WinnerNumb + 1).gameObject.SetActive(true);

                Time.timeScale = 0f;
            }
            break;

        // ------------------------------------------------------ PLAYERS POSITIONS UPDATE ------------------------------------------------------
        case "SBP":
            if (PlayerNumber != 0)
            {
                NPCPlayers[0].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            }
            break;

        case "SEP":
            if (PlayerNumber != 1)
            {
                NPCPlayers[1].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            }
            break;

        case "SLP":
            if (PlayerNumber != 2)
            {
                NPCPlayers[2].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            }
            break;

        case "SSP":
            if (PlayerNumber != 3)
            {
                NPCPlayers[3].UpdatePosition(float.Parse(deltas[1]), float.Parse(deltas[2]), float.Parse(deltas[3]));
            }
            break;

        // ------------------------------------------------------ POWERS STATUS UPDATE ------------------------------------------------------
        case "PWR":
            int SelectedPower;
            if (Int32.TryParse(deltas[1], out SelectedPower))
            {
                PowerUpsManager.getInstance().Warning(SelectedPower, float.Parse(deltas[2]), float.Parse(deltas[3]));
            }
            break;

        case "OBS":
            int SelectedObstacle;
            if (Int32.TryParse(deltas[1], out SelectedObstacle))
            {
                ObstaclesManager.getInstance().Warning(SelectedObstacle);
            }
            break;

        // ------------------------------------------------------ POWERS EFFECTS ------------------------------------------------------
        case "FP":
            int FirePowerSafePlayer;
            if (Int32.TryParse(deltas[1], out FirePowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(1).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != FirePowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetOnFire();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetOnFire();
                        }
                    }
                }
            }
            break;

        case "IP":
            int IcePowerSafePlayer;
            if (Int32.TryParse(deltas[1], out IcePowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(0).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != IcePowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetFrozen();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetFrozen();
                        }
                    }
                }
            }

            break;

        case "CP":
            int ConfusionPowerSafePlayer;
            if (Int32.TryParse(deltas[1], out ConfusionPowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(2).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != ConfusionPowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetConfused();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetConfused();
                        }
                    }
                }
            }
            break;

        case "BP":
            int BouncePowerSafePlayer;
            if (Int32.TryParse(deltas[1], out BouncePowerSafePlayer))
            {
                PowerUpsManager.getInstance().transform.GetChild(3).gameObject.SetActive(false);
                GameCanvas.getInstance().transform.GetChild(3).GetChild(5).gameObject.SetActive(false);

                for (int i = 0; i < 4; i++)
                {
                    if (i != BouncePowerSafePlayer)
                    {
                        if (i == PlayerNumber)
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <BaseController>().SetBounce();
                        }
                        else
                        {
                            GameManager.getInstance().transform.GetChild(3).GetChild(i).GetComponent <NPCController>().SetBounce();
                        }
                    }
                }
            }
            break;

        default:
            Debug.Log("Error - message not recognized: " + msg);
            break;
        }
    }
コード例 #13
0
ファイル: PowerUps.cs プロジェクト: lhnguyens/ColourRun
 private void Start()
 {
     pwM = FindObjectOfType <PowerUpsManager>();
 }