Пример #1
0
 //définit l'apparence de l'outline du mur selon sa propriété
 public Mesh[] UpdateWallShadowAppearance(WallProprieties wallProprieties)
 {
     if (wallProprieties.GetIsBouncy())
     {
         Mesh[] tempWallShadowAppearance = new Mesh[wallBouncyShadowAppearance.Length];
         for (int i = 0; i < wallBouncyShadowAppearance.Length; i++)
         {
             tempWallShadowAppearance[i] = wallBouncyShadowAppearance[i];
         }
         return(tempWallShadowAppearance);
     }
     else if (wallProprieties.GetIsIndestructible())
     {
         Mesh[] tempWallShadowAppearance = new Mesh[wallIndestructibleShadowAppearance.Length];
         for (int i = 0; i < wallIndestructibleShadowAppearance.Length; i++)
         {
             tempWallShadowAppearance[i] = wallIndestructibleShadowAppearance[i];
         }
         return(tempWallShadowAppearance);
     }
     else
     {
         Mesh[] tempWallShadowAppearance = new Mesh[wallNormalShadowAppearance.Length];
         for (int i = 0; i < wallNormalShadowAppearance.Length; i++)
         {
             tempWallShadowAppearance[i] = wallNormalShadowAppearance[i];
         }
         return(tempWallShadowAppearance);
     }
 }
Пример #2
0
 //gère les dommages des murs connectés
 public void ConnectedtWallDammage(float myDammage, GameObject thisWall, WallProprieties connectedWallProprieties, WallChange connectedWallChange)
 {
     if (!connectedWallProprieties.GetIsIndestructible())
     {
         connectedWallChange.SetDammageFromConnect(myDammage);
     }
 }
Пример #3
0
    public void IAmConnectedIMustConnect()
    {
        if (_isConnected)
        {
            _connectedWall = _wallManagerScript.SetConnectedWall(gameObject);
        }

        if (_connectedWall != null)
        {
            _connectedWallProprieties = _connectedWall.GetComponent <WallProprieties>();
            _connectedWallChange      = _connectedWall.GetComponent <WallChange>();
        }
    }
Пример #4
0
    private void Awake()
    {
        gameObject.layer = 15;

        //récupération des scripts
        _arenaRotationScript   = arena.GetComponent <ArenaRotation>();
        _wallManagerScript     = GameObject.FindWithTag("WallController").GetComponent <WallManager>();
        _gameManagerScript     = GameObject.FindWithTag("GameController").GetComponent <GameManager>();
        _scoreManagerScript    = GameObject.FindWithTag("GameController").GetComponent <ScoreManager>();
        _faceClassScript       = GameObject.FindWithTag("GameController").GetComponent <FaceClass>();
        _wallProprieties       = GetComponent <WallProprieties>();
        _newSoundManagerScript = NewSoundManager.instance;
    }
Пример #5
0
    //définit quel mur affiché selon sa propriété
    public void WhichWall(WallProprieties wallProprieties)
    {
        if (wallProprieties.GetIsBouncy())
        {
            wallProprieties.theWalls[2].SetActive(true);
        }
        else if (wallProprieties.GetIsIndestructible())
        {
            wallProprieties.theWalls[1].SetActive(true);
        }
        else
        {
            wallProprieties.theWalls[0].SetActive(true);
        }

        if (wallProprieties.GetIsConnected())
        {
            wallProprieties.theWalls[3].SetActive(true);
        }
    }
Пример #6
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        //si on touche un mur on un joueur, joue un son différent
        if (collision.gameObject.tag.Contains("Walls"))
        {
            WallProprieties collisionScript = collision.gameObject.GetComponent <WallProprieties>();
            onomatopéeTimer = 0;

            wallHitSpriteTimer           = 0;
            wallSpritePosition           = new Vector3(collision.GetContact(0).point.x, collision.GetContact(0).point.y, 8);
            wallSpriteTransform.position = wallSpritePosition;
            wallSpriteTransform.gameObject.SetActive(true);
            playerScaleHitWall = true;
        }
        //son collision avec joueurs
        else if (collision.gameObject.tag.Contains("Player"))
        {
            if (_newSoundManagerScript != null)
            {
                _newSoundManagerScript.PlaySound(1);
            }
            wallSpriteTransform.gameObject.SetActive(false);

            onomatopéesSprite.enabled = true;
            onomatopéesSprite.sprite  = onomatopeesTab[Random.Range(0, onomatopeesTab.Length - 1)];
            onomatopéeTimer           = 0;
            _touchedByPlayer          = true;
            PlayerEntity otherPlayer = collision.gameObject.GetComponent <PlayerEntity>();
            //charge la jauge d'ulti et active les Fxs correspondant à l'état de la jauge
            if (_lastFrameVelocity.magnitude > otherPlayer._lastFrameVelocity.magnitude)
            {
                _animator.SetBool("isHitting", true);
                _playerScoreImage.sprite = _playerScoreImageSprites[0];
                _ultiCurrentCharge      += ultiChargeRatio * _lastFrameVelocity.magnitude;

                if (_ultiCurrentCharge > ultiChargeMax / 3 && _ultiCurrentCharge < ultiChargeMax * 0.66f)
                {
                    UltiFxStates[0].SetActive(true);
                    UltiFxStates[1].SetActive(false);
                    UltiFxStates[2].SetActive(false);
                }
                else if (_ultiCurrentCharge >= ultiChargeMax * 0.66f && _ultiCurrentCharge < ultiChargeMax)
                {
                    UltiFxStates[0].SetActive(false);
                    UltiFxStates[1].SetActive(true);
                    UltiFxStates[2].SetActive(false);
                }
                else if (_ultiCurrentCharge >= ultiChargeMax)
                {
                    UltiFxStates[0].SetActive(false);
                    UltiFxStates[1].SetActive(false);
                    UltiFxStates[2].SetActive(true);
                }

                if (_ultiCurrentCharge >= ultiChargeMax)
                {
                    _ultiCurrentCharge = ultiChargeMax;
                    _isUltiPossible    = true;
                }
                //rebonds
                if (otherPlayer._lastFrameVelocity.magnitude <= new Vector3(0.2f, 0.2f, 0.2f).magnitude)
                {
                    Rebound((-_lastFrameVelocity * reboundPourcentageOfSpeedIfImFaster) / 100, collision.GetContact(0).normal, frictionPlayer);
                }
                else
                {
                    Rebound((otherPlayer.GetLastFrameVelocity() * reboundPourcentageOfSpeedIfImFaster) / 100, collision.GetContact(0).normal, frictionPlayer);
                }
                otherPlayer.Rebound((_lastFrameVelocity * otherPlayer.reboundPourcentageOfSpeedIfImSlower) / 100, collision.GetContact(0).normal, otherPlayer.frictionPlayer);
            }
            else
            {
                _ultiCurrentCharge += ultiChargeRatio * _lastFrameVelocity.magnitude;
                _animator.SetBool("isHit", true);
                _playerScoreImage.sprite = _playerScoreImageSprites[1];

                if (_lastFrameVelocity.magnitude <= new Vector3(0.2f, 0.2f, 0.2f).magnitude)
                {
                    otherPlayer.Rebound((-otherPlayer.GetLastFrameVelocity() * otherPlayer.reboundPourcentageOfSpeedIfImFaster) / 100, collision.GetContact(0).normal, otherPlayer.frictionPlayer);
                }
                else
                {
                    otherPlayer.Rebound((_lastFrameVelocity * otherPlayer.reboundPourcentageOfSpeedIfImFaster) / 100, collision.GetContact(0).normal, otherPlayer.frictionPlayer);
                }
                Rebound((otherPlayer.GetLastFrameVelocity() * reboundPourcentageOfSpeedIfImSlower) / 100, collision.GetContact(0).normal, frictionPlayer);
            }
        }
    }