Beispiel #1
0
 private void Awake()
 {
     cam           = GameManager.Instance.CameraMain;
     enabledScript = true;
     updateTimer.Reset();
     updateTimer.Ready();
 }
Beispiel #2
0
 /// <summary>
 /// change IA at every frame
 /// </summary>
 private void Update()
 {
     if (frequency.Ready())
     {
         Machine();
     }
 }
Beispiel #3
0
 // Unity functions
 private void Update()
 {
     if (updateTimer.Ready())
     {
         CheckOnCamera();
     }
 }
    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();
            }
        }
    }
Beispiel #5
0
 private void Update()
 {
     //optimisation des fps
     if (updateTimer.Ready())
     {
     }
 }
Beispiel #6
0
    // Unity functions

    private void Update()
    {
        if (updateTimer.Ready())
        {
            isOnScreen = CheckOnCamera();
        }
    }
Beispiel #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();
            }
        }
    }
 private void Update()
 {
     //optimisation des fps
     if (updateTimer.Ready())
     {
         SetListOverlap();
     }
 }
Beispiel #9
0
 private void Update()
 {
     InputMenu();
     //optimisation des fps
     if (updateTimer.Ready())
     {
     }
 }
Beispiel #10
0
 private void Update()
 {
     InputMenu();
     //optimisation des fps
     if (updateTimer.Ready())
     {
         DebugMouseCLick();
     }
 }
Beispiel #11
0
 protected override void Shoot()
 {
     if (shootFrequency.Ready())
     {
         if (weaponHandle)
         {
             weaponHandle.UseWeapon();
         }
     }
 }
    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);
        }
    }
Beispiel #13
0
    private void Update()
    {
        if (!enabledPlayer)
        {
            return;
        }

        if (updateTimer.Ready())
        {
        }

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

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

            if (freezeCamera)
            {
                return;
            }

            FindAveragePosition();
        }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Unity functions

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


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

            if (freezeCamera)
            {
                return;
            }

            FindAveragePosition();
        }
    }
Beispiel #19
0
 protected override void Shoot()
 {
     if (shootFrequency.Ready())
     {
         if (currentNumberOfShoots < NumberOfShoots)
         {
             if (weaponHandle.UseWeapon())
             {
                 currentNumberOfShoots++;
             }
         }
         else
         {
             currentNumberOfShoots = 0;
         }
     }
 }
Beispiel #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);
             }
         }
     }
 }
    /// <summary>
    /// update la position
    /// </summary>
    void Update()
    {
        if (isActive)
        {
            if (updateTimer.Ready())
            {
                UpdateVisibility();
            }

            if (isVisible)
            {
                UpdateFade();
                UpdateScale();
                UpdateScaleAnimation();
                UpdateUICanvas();
            }
        }
    }
Beispiel #22
0
    private void Update()
    {
        if (!enableWin)
        {
            return;
        }

        if (currentState > VictoryStates.NotWin)
        {
            //optimisation des fps
            if (updateTimer.Ready())
            {
                InputVictory();
                InputEnteringNames();
                Victory();
            }
        }
    }
Beispiel #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();
             }
         }
     }
 }
Beispiel #24
0
 private void Update()
 {
     if (!paused)
     {
         InputGame();
     }
     if (transitionState && slowMowActivated)
     {
         CancelSLowMow();
     }
     if (!cameraZoomTransitionOver)
     {
         DezoomCamera();
     }
     //optimisation des fps
     if (updateTimer.Ready())
     {
     }
 }
Beispiel #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();
            }
        }
    }
Beispiel #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
        }
    }
Beispiel #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;
        }
    }
Beispiel #28
0
 private void Awake()
 {
     coolDownRestart.Ready();
 }
Beispiel #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();
                }
            }
        }
    }