예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (GameObject.FindWithTag("MenuManager") != null)
        {
            _menuInformationScript = GameObject.FindWithTag("MenuManager").GetComponent <GetMenuInformation>();
        }


        _newSoundManagerScript = NewSoundManager.instance;
        _scoreManagerScript    = GameObject.FindWithTag("GameController").GetComponent <ScoreManager>();
        _playerManagerScript   = GameObject.FindWithTag("GameController").GetComponent <PlayerManager>();


        _myRb        = GetComponent <Rigidbody2D>();
        _playerTrail = GetComponent <TrailRenderer>();
        _animator    = GetComponent <Animator>();

        powerJauge.fillAmount = 0;
        powerJaugeParent.gameObject.SetActive(false);

        _velocityMax = (powerMax * speed) * (powerMax * speed);



        onomatopéesSprite.enabled = false;
        sweatParticles.SetActive(false);
        UltiFxStates[0].SetActive(false);
        UltiFxStates[1].SetActive(false);
        UltiFxStates[2].SetActive(false);
        wallHitSpriteTimerMax = onomatopéeTimerMax;

        string thisTag = gameObject.tag;

        switch (thisTag)
        {
        case "Player1":
            wallSpriteTransform = GameObject.FindWithTag("WallHitSprite1").transform;
            break;

        case "Player2":
            wallSpriteTransform = GameObject.FindWithTag("WallHitSprite2").transform;
            break;

        case "Player3":
            wallSpriteTransform = GameObject.FindWithTag("WallHitSprite3").transform;
            break;

        case "Player4":
            wallSpriteTransform = GameObject.FindWithTag("WallHitSprite4").transform;
            break;
        }
        wallSpriteTransform.gameObject.SetActive(false);

        playerSprite  = transform.GetChild(0).gameObject;
        originalScale = playerSprite.transform.localScale.x;
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        if (GameObject.FindWithTag("MenuManager") != null)
        {
            _menuInformationScript = GameObject.FindWithTag("MenuManager").GetComponent <GetMenuInformation>();
        }

        currentFace           = 0;
        powerJauge.fillAmount = 0;
        powerJaugeParent.gameObject.SetActive(false);
        _velocityMax = (powerMax * speed) * (powerMax * speed);
    }
예제 #3
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        getMenuInfoScript = GetMenuInformation.Instance;
    }
예제 #4
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
     //permet de garder cet objet lors de la transition du menu à la scène de jeu
     DontDestroyOnLoad(this.gameObject);
     vibrationBool = true;
 }
예제 #5
0
    // Start is called before the first frame update
    void Start()
    {
        //set les paramètres de la shockwave au début pour qu'elle soit lançable
        shockWaveCooldown      = 0;
        shockWaveDuration      = shockWaveDurationMax;
        _playerManagerScript   = GameObject.FindWithTag("GameController").GetComponent <PlayerManager>();
        _playerEntityScript    = GetComponent <PlayerEntity>();
        _shockWaveHitScript    = GetComponent <ShockwaveHit>();
        _scoreManagerScript    = GameObject.FindWithTag("GameController").GetComponent <ScoreManager>();
        cameraMain             = Camera.main;
        _newSoundManagerScript = NewSoundManager.instance;
        if (GameObject.FindWithTag("MenuManager") != null)
        {
            _menuInformationScript = GameObject.FindWithTag("MenuManager").GetComponent <GetMenuInformation>();
        }



        string thisTag = gameObject.tag;

        switch (thisTag)
        {
        case "Player1":
            _playerScoreImage = GameObject.FindWithTag("PlayerOneImage").GetComponent <Image>();
            _ultiCrack        = GameObject.FindWithTag("PlayerOneCrack");
            break;

        case "Player2":
            _playerScoreImage = GameObject.FindWithTag("PlayerTwoImage").GetComponent <Image>();
            _ultiCrack        = GameObject.FindWithTag("PlayerTwoCrack");
            break;

        case "Player3":
            _playerScoreImage = GameObject.FindWithTag("PlayerThreeImage").GetComponent <Image>();
            _ultiCrack        = GameObject.FindWithTag("PlayerThreeCrack");
            break;

        case "Player4":
            _playerScoreImage = GameObject.FindWithTag("PlayerFourImage").GetComponent <Image>();
            _ultiCrack        = GameObject.FindWithTag("PlayerFourCrack");
            break;
        }
        _ultiCrack.SetActive(false);
        _playerEntityScript.PlayerScoreImageSet(_playerScoreImage);
        _crackStartingColor = _ultiCrack.GetComponent <SpriteRenderer>().color;
    }
예제 #6
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        _myAudios      = GetComponents <AudioSource>();
        _playerCharges = new AudioSource[4];
        for (int i = 0; i < 4; i++)
        {
            _playerCharges[i] = _myAudios[i];
        }
        if (GameObject.FindWithTag("MenuManager") != null)
        {
            _menuInformationScript = GameObject.FindWithTag("MenuManager").GetComponent <GetMenuInformation>();
        }
    }
예제 #7
0
    private void Awake()
    {
        _scoreManagerScript   = GetComponent <ScoreManager>();
        _faceClassScript      = GetComponent <FaceClass>();
        _arenaRotationScript  = arena.GetComponent <ArenaRotation>();
        _wallManagerScript    = GameObject.FindWithTag("WallController").GetComponent <WallManager>();
        menuInfoMouvementBool = new bool[4];


        if (GameObject.FindWithTag("MenuManager") != null)
        {
            _menuInformationScript = GameObject.FindWithTag("MenuManager").GetComponent <GetMenuInformation>();

            //permet de set les controles et d'instantier les personnages joueurs en fonction du nombre de joueurs
            if (_menuInformationScript != null && playerList.Count > 0)
            {
                _scoreManagerScript.nbrPlayers = 0;
                for (int i = playerList.Count; i-- > 0;)
                {
                    playerList[i].SetActive(false);
                }
                playerList.Clear();
            }
            for (int i = 0; i < _menuInformationScript.numbersOfPlayers; i++)
            {
                GameObject playerInstantiation = Instantiate(playerPrefabs[i]);
                playerList.Add(playerInstantiation);
                _scoreManagerScript.nbrPlayers++;
            }

            for (int i = 0; i < _menuInformationScript.getPlayerMouvementMode().Length; i++)
            {
                menuInfoMouvementBool[i] = _menuInformationScript.getPlayerMouvementMode()[i];
            }
        }

        playersEntityScripts = new PlayerEntity[playerList.Count];
        attackTestScripts    = new AttackTest[playerList.Count];
        playerMax            = playerList.Count;

        currentPlayersOnArena = playerMax;

        for (int i = playerList.Count; i-- > 0;)
        {
            currentPlayersList.Add(playerList[i]);
        }

        if (playerList.Count == 2)
        {
            wallHitObj[0].SetActive(false);
            wallHitObj[1].SetActive(false);
            playerUISprite[2].SetActive(false);
            playerUISprite[3].SetActive(false);
            CracksObj[2].SetActive(false);
            CracksObj[3].SetActive(false);
        }
        else if (playerList.Count == 3)
        {
            CracksObj[3].SetActive(false);
            wallHitObj[1].SetActive(false);
            playerUISprite[3].SetActive(false);
        }
    }