Exemplo n.º 1
0
 private void Awake()
 {
     cam           = GameManager.Instance.CameraMain;
     enabledScript = true;
     updateTimer.Reset();
     updateTimer.Ready();
 }
Exemplo n.º 2
0
 /// <summary>
 /// change IA at every frame
 /// </summary>
 private void Update()
 {
     if (frequency.Ready())
     {
         Machine();
     }
 }
Exemplo n.º 3
0
 // Unity functions
 private void Update()
 {
     if (updateTimer.Ready())
     {
         CheckOnCamera();
     }
 }
Exemplo n.º 4
0
    private void Update()
    {
        //freezeCamera = targetList.Count == 0 && fallBackTarget == null;
        SetFreez();

        //if (targetList.Count == 0 && ((fallBackTarget && !fallBack) || fallBackTarget == null))
        //  freezeCamera = true;

        if (updateTimer.Ready())
        {
            CleanListTarget();

            if (freezeCamera)
            {
                return;
            }

            if (useWeight)
            {
                FindWeightPosition();
            }
            else
            {
                FindAveragePosition();
            }
        }
    }
Exemplo n.º 5
0
 private void Update()
 {
     //optimisation des fps
     if (updateTimer.Ready())
     {
     }
 }
Exemplo n.º 6
0
    // Unity functions

    private void Update()
    {
        if (updateTimer.Ready())
        {
            isOnScreen = CheckOnCamera();
        }
    }
Exemplo n.º 7
0
    private void Update()
    {
        if (!enabledBullet) //si le bullet est désactivé, ne pas effectuer de test...
        {
            return;
        }

        MoveProjectile();

        if (maxDistance > 0)
        {
            Vector3 distance = transform.position - startPosition;
            if (distance.magnitude > maxDistance)
            {
                OnProjectileTooFar();
            }
        }

        if (updateTimer.Ready())
        {
            if (!isOnCamera.enabled)
            {
                isOnCamera.enabled = true;
            }
            if (!isOnCamera.isOnScreen)
            {
                Kill();
            }
        }
    }
Exemplo n.º 8
0
 private void Update()
 {
     //optimisation des fps
     if (updateTimer.Ready())
     {
         SetListOverlap();
     }
 }
Exemplo n.º 9
0
 private void Update()
 {
     InputMenu();
     //optimisation des fps
     if (updateTimer.Ready())
     {
     }
 }
Exemplo n.º 10
0
 private void Update()
 {
     InputMenu();
     //optimisation des fps
     if (updateTimer.Ready())
     {
         DebugMouseCLick();
     }
 }
Exemplo n.º 11
0
 protected override void Shoot()
 {
     if (shootFrequency.Ready())
     {
         if (weaponHandle)
         {
             weaponHandle.UseWeapon();
         }
     }
 }
Exemplo n.º 12
0
    private void Update()
    {
        if (frequency.Ready())
        {
            //Debug.Log("launch machine");
            iaManager.Machine();

            m_audioSource.volume = 0.1f + GetGlobalVel() / 50;
            m_audioSource.pitch  = Mathf.Min(0.5f + GetGlobalVel() / 50, 1);
        }
    }
Exemplo n.º 13
0
    private void Update()
    {
        if (!enabledPlayer)
        {
            return;
        }

        if (updateTimer.Ready())
        {
        }

        InputPlayer();
    }
Exemplo n.º 14
0
 private void Update()
 {
     //optimisation des fps
     if (updateTimer.Ready())
     {
         if (isOnCamera && enemyToActivate)
         {
             if (isOnCamera.isOnScreen)
             {
                 enemyToActivate.WantToEnable = true;
             }
         }
     }
 }
Exemplo n.º 15
0
 private void FixedUpdate()
 {
     if (!calculateEveryFixedFrame)
     {
         if (frequencyTimer.Ready())
         {
             CalculateGAGravity();
         }
     }
     else
     {
         CalculateGAGravity();
     }
 }
Exemplo n.º 16
0
 private void Update()
 {
     if (!enableTuto)
     {
         return;
     }
     InputTuto();
     //optimisation des fps
     if (updateTimer.Ready())
     {
         UpdateMoveLeft();
         UpdateRedLine();
         //UpdateLockJoypad();
     }
 }
Exemplo n.º 17
0
    private void Update()
    {
        SetFreez();
        LerpSmooth();

        if (updateTimer.Ready())
        {
            CleanListTarget();

            if (freezeCamera)
            {
                return;
            }

            FindAveragePosition();
        }
    }
Exemplo n.º 18
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Unity functions

    private void Update()
    {
        freezeCamera = targetList.Count == 0 && fallBackTarget == null;


        if (updateTimer.Ready())
        {
            CleanListTarget();

            if (freezeCamera)
            {
                return;
            }

            FindAveragePosition();
        }
    }
Exemplo n.º 19
0
 protected override void Shoot()
 {
     if (shootFrequency.Ready())
     {
         if (currentNumberOfShoots < NumberOfShoots)
         {
             if (weaponHandle.UseWeapon())
             {
                 currentNumberOfShoots++;
             }
         }
         else
         {
             currentNumberOfShoots = 0;
         }
     }
 }
Exemplo n.º 20
0
 // Update is called once per frame
 void Update()
 {
     if (updateTimer.Ready())
     {
         if (wantToDisable)
         {
             wantToDisable = false;
             if (desactiveParent && parent)
             {
                 parent.SetActive(false);
             }
             else
             {
                 gameObject.SetActive(false);
             }
         }
     }
 }
Exemplo n.º 21
0
    /// <summary>
    /// update la position
    /// </summary>
    void Update()
    {
        if (isActive)
        {
            if (updateTimer.Ready())
            {
                UpdateVisibility();
            }

            if (isVisible)
            {
                UpdateFade();
                UpdateScale();
                UpdateScaleAnimation();
                UpdateUICanvas();
            }
        }
    }
Exemplo n.º 22
0
    private void Update()
    {
        if (!enableWin)
        {
            return;
        }

        if (currentState > VictoryStates.NotWin)
        {
            //optimisation des fps
            if (updateTimer.Ready())
            {
                InputVictory();
                InputEnteringNames();
                Victory();
            }
        }
    }
Exemplo n.º 23
0
 /// <summary>
 /// effectué à chaque frame
 /// </summary>
 private void Update()
 {
     //optimisation des fps
     if (updateTimer.Ready())
     {
         if (player && !isSpawning && !player.activeInHierarchy && StateManager.GetSingleton.State < StateManager.GameState.GameOver)
         {
             if (spawnedOnce)
             {
                 prepareSpawning();
             }
             else
             {
                 isSpawning = true;
                 spawnIt();
             }
         }
     }
 }
Exemplo n.º 24
0
 private void Update()
 {
     if (!paused)
     {
         InputGame();
     }
     if (transitionState && slowMowActivated)
     {
         CancelSLowMow();
     }
     if (!cameraZoomTransitionOver)
     {
         DezoomCamera();
     }
     //optimisation des fps
     if (updateTimer.Ready())
     {
     }
 }
Exemplo n.º 25
0
    private void Update()
    {
        //InputMenu();
        //optimisation des fps
        if (updateTimer.Ready())
        {
            if (leaderboard.uploadedScore && !displayed)
            {
                SetupLeaderboard();
                displayed = true;
            }

            if (!EventSystem.current.currentSelectedGameObject)
            {
                print("autoselect");
                backButton.Select();
            }
        }
    }
Exemplo n.º 26
0
    private void Update()
    {
        if (updateTimer.Ready())
        {
        }

        if (!desactivateGameOverAndVictory && StateManager.GetSingleton.State < StateManager.GameState.Pause)
        {
            //IsGameOver();
            winManager.IsVictory();
        }

        /*else if (StateManager.GetSingleton.State == StateManager.GameState.Pause)
         * {
         *  InputPause();
         * }*/


        //InputGameOver();
        if (!paused)
        {
            InputQuit(); //input quitter
        }
    }
Exemplo n.º 27
0
    protected void Update()
    {
        if (!isDead)
        {
            if (((isOnCamera && isOnCamera.isOnScreen) || (!isOnCamera && wantToEnable)) && !enableEnemy) // Si l'ennemi vient d'apparaitre & n'a pas déja été spawn
            {
                OnEnemyEnable();
            }

            if (!enableEnemy)
            {
                return;
            }

            if (isMoving)
            {
                if (!coroutinePrepareToMoveStarted && !readyToMove)
                {
                    StartCoroutine(ReadyToMove(timeBeforeMoving));
                }

                if (readyToMove)
                {
                    Move();
                }
            }
            else
            {
                readyToMove = false;
            }

            if (isShooting)
            {
                Shoot();
            }

            //optimisation des fps
            if (updateTimer.Ready())
            {
                if (isOnCamera)
                {
                    if (!isOnCamera.enabled)
                    {
                        isOnCamera.enabled = true;
                    }
                    if (!isOnCamera.isOnScreen)
                    {
                        wantToDisable = true; // Kill si sort de l'écran
                    }
                }

                if (wantToDisable) // Sert pour gérer le cas ou l'ennemi est activé depuis l'exterieur
                {
                    wantToEnable = false;
                    Kill();
                }
            }

            lastFrameMoving = isMoving;
        }
    }
Exemplo n.º 28
0
 private void Awake()
 {
     coolDownRestart.Ready();
 }
Exemplo n.º 29
0
    public void Update()
    {
        if (launched)
        {
            currentDuration += Time.deltaTime;

            //optimisation des fps
            if (updateTimer.Ready())
            {
                if (playersToPush.Count > 0)
                {
                    List <PlayerController> tmpPlayers = new List <PlayerController>(playersToPush);
                    foreach (var playerToPush in tmpPlayers)
                    {
                        Vector3 diff = (playerToPush.transform.position - usePosition);
                        float   dtDistanceBetweenSourceAndTarget = diff.magnitude / radius;
                        if (diff.magnitude > radius) // si entité + loins que radius, plus besoin de la bouger
                        {
                            playerToPush.PlayerBody.AddForce(diff, ForceMode.Impulse);
                            playerToPush.InhibCoeff = 1.0f;
                            playersToPush.Remove(playerToPush);
                            break;
                        }

                        //playerToPush.InhibCoeff = 0.0f;
                        var lessSpeedOverDistance = Mathf.Max(1 - dtDistanceBetweenSourceAndTarget, 0.25f);
                        diff.Normalize(); // On veut une distance normalisée
                        Vector3 dirWanted = diff * speedPush * Time.deltaTime * lessSpeedOverDistance;
                        Vector3 newPos    = playerToPush.transform.position + playerToPush.transform.TransformDirection(dirWanted);

                        RaycastHit hit;
                        Physics.Raycast(playerToPush.transform.position, diff, out hit, radius, 1 << 12);
                        if (hit.collider && hit.collider.bounds.Contains(newPos))
                        {
                            print("hit wall");
                            playerToPush.transform.position = hit.point;
                            playerToPush.InhibCoeff         = 1.0f;
                            playersToPush.Remove(playerToPush);
                        }
                        else
                        {
                            playerToPush.transform.Translate(dirWanted);
                        }
                    }
                }
                else
                {
                    if (playersToPush.Count > 0)
                    {
                        //print("Yo");
                        foreach (var playerToPush in playersToPush)
                        {
                            playerToPush.InhibCoeff = 1.0f;
                        }

                        playersToPush.Clear();
                    }
                    //print("Stop this shit");
                    Stop();
                }
            }
        }
    }