Beispiel #1
0
        void TalkingState()
        {
            if (Talking && !Managers.Dialog.IsInConversation())
            {
                StartTalk();
            }

            if (!Talking && !Managers.Dialog.IsInConversation())
            {
                EndTalk();
            }

            AoAnim.PlayFramesFixed(3, 0, 2, Orientation);
        }
Beispiel #2
0
        void Cry()
        {
            Shield.SetActive(false);
            lightHead.SetActive(false);
            lightTrace.SetActive(false);
            lightStart.SetActive(false);
            Staff.SetActive(false);
            Anime.PlayFramesFixed(2, 1, 2, Orientation);

            if (Talking && !Managers.Dialog.IsInConversation())
            {
                StartTalk();
            }

            if (!Talking && Managers.Dialog.IsInConversation())
            {
                (Managers.Game.PlayerPrefab.GetComponent <CameraTargetAttributes>()).Offset.x =
                    (transform.position.x - Managers.Game.PlayerPrefab.transform.position.x) * .5f;
            }


            if (!Talking && !Managers.Dialog.IsInConversation())
            {
                EndTalk();
            }
        }
Beispiel #3
0
        void Run()
        {
            Anime.PlayFramesFixed(0, 0, 3, Orientation);

            NewPosition = new Vector3(NewPosition.x + (Time.deltaTime * 5 * Orientation), NewPosition.y, .25f);

            //if ( Mathf.Approximately(NewPosition.x, BossArea.center.x) )
            //    Destroy(Instantiate(particle,
            //                                thisTransform.position + (Vector3.right * Orientation) + (Vector3.back * 2),
            //                                thisTransform.rotation), 5);

            if (NewPosition.x > BossArea.xMax - 1)
            {
                AttackRange++;
                Orientation = -1;
            }

            if (NewPosition.x < BossArea.xMin + 1)
            {
                AttackRange++;
                Orientation = +1;
            }

            if (AttackRange > 2)
            {
                AttackRange = 0;
                timeLapse   = 0;
                DashFire.SetActive(false);
                YaguaState = BossState.Standing;
            }
        }
Beispiel #4
0
        // Update is called once per frame
        void Update()
        {
            if (!PlayerTransform)
            {
                if (Managers.Game.PlayerPrefab)
                {
                    PlayerTransform = Managers.Game.PlayerPrefab.transform;                     //	We can Use this system to get the player's Id & position
                }
                else
                {
                    return;
                }
            }

            NewPosition = thisTransform.position;

            if ((Mathf.Abs(PlayerTransform.position.x - NewPosition.x) < 1.5f))
            {
                StartMoving = true;
            }

            if (StartMoving && timeLapse > 0)
            {
                timeLapse -= Time.deltaTime * 2;
            }

            if (StartMoving && timeLapse <= 0)
            {
                Anima.PlayFramesFixed(0, 0, 3, Orientation);
                NewPosition = new Vector3(NewPosition.x + (Time.deltaTime * 3.5f * Orientation), NewPosition.y, NewPosition.z);


                if (NewPosition.x > PlayerTransform.position.x + 5)
                {
                    Destroy(gameObject);
                }
            }
            else
            {
                Anima.PlayFramesFixed(1, 0, 3, Orientation, 1.005f);
            }

            thisTransform.position = NewPosition;
        }
Beispiel #5
0
        void Collapsing()
        {
            TimeLapse += Time.deltaTime;

            if (TimeLapse < 1)
            {
                AoAnim.PlayFramesFixed(3, (int)((TimeLapse) * 4), 1, Orientation);
            }

            if (TimeLapse > 1)
            {
                AoAnim.PlayFramesFixed(3, 3, 1, Orientation);
            }

            if (TimeLapse > 2)
            {
                TimeLapse    = 0;
                CurrentState = SceneState.Talking;
                Talking      = true;
            }
        }
Beispiel #6
0
    void ChasePlayer()
    {
        orientation = (int)Mathf.Sign(playerTransform.position.x - thisTransform.position.x);
        aniPlay.PlayFramesFixed(3, 0, 4, orientation);


        Vector3 Distance   = playerTransform.position + (Vector3.up) - thisTransform.position;
        float Displacement = moveSpeed * Time.deltaTime;


        thisTransform.position += (Distance.normalized * Displacement);
        thisTransform.position += (Vector3.up * Mathf.Sin(Time.time * 5) * Time.deltaTime);
    }
Beispiel #7
0
    IEnumerator CoUpdate()                                                      // void  Update (){
    {
        while (thisTransform)
        {
            if (!target)
            {
                if (Managers.Game.PlayerPrefab)
                {
                    target = Managers.Game.PlayerPrefab.transform;
                    linkToPlayerControls = (PlayerControls)target.GetComponent <PlayerControls>();
                }
                else
                {
                    yield return(0);
                }
            }

            if (target)
            {
                if (thisTransform.IsChildOf(target))                                    // check if the player has taken us...
                {
                    thisTransform.position = target.position + HoldedPosition;          // Update own hold position & player's too
                    enemyState             = ShooterState.Holded;                       // & change enemy state to holded..
                }
                else
                {
                    distanceToTarget = (target.position - thisTransform.position).sqrMagnitude; // it's much faster using Square mag.
                }
            }
            switch (enemyState)                 // check states of the character:
            {
            case ShooterState.Sleeping:         // 0# GAUCHO SLEEPING:
                StartCoroutine(Sleeping());
                break;

            case ShooterState.Alert:            // 1# ALERT STATE:
                velocity = Vector3.zero;

                StartCoroutine(Search());                                                                                                               // Begin Searching of the player & attack him
                break;

            //		case ShooterState.Stunned:      // 2# KNOCK OUT:
            //				velocity = Vector3.zero;
            //
            //				Stunned();
            //			break;

            case ShooterState.Holded:           // 3# ENEMY IS TAKEN
                BeingHolded();
                break;

            case ShooterState.Shooted:          // 4# ENEMY IS THROWED IN THE AIR
                thisTransform.RotateAround(Vector3.forward, -orientation * 2 * Time.deltaTime);

                break;

            case ShooterState.Dead:                     // 5# ENEMY IS DEAD
                animPlay.PlayFramesFixed(1, 1, 1, orientation);
                thisTransform.RotateAround(Vector3.forward, -orientation * 45 * Time.deltaTime);
                grounded = false;

                //				Destroy(gameObject, 15);											// Keep falling and die after a while
                break;
            }

            if (!grounded)
            {
                velocity.y -= gravity * Time.deltaTime;
            }
            thisTransform.position += velocity * Time.deltaTime;

            if (thisTransform.position.y < 0 && thisTransform != null)
            {
                Destroy(gameObject, 2);                                                         // If character falls get it up again
            }
            yield return(0);
        }
    }
Beispiel #8
0
    IEnumerator CoUpdate()
    {
        while (thisTransform)
        {
            switch (currentState)
            {
            case EnemyState.StandBy:
                if (!playerTransform)
                {
                    if (Managers.Game.PlayerPrefab)
                    {
                        playerTransform = Managers.Game.PlayerPrefab.transform;                                 //	We can Use this system to get the player's Id & position
                        playerControl   = playerTransform.GetComponent <PlayerControls>();
                        //playerProps = playerTransform.GetComponent<PlayerProperties>();
                        //playerController = playerTransform.GetComponent<CharacterController>();
                        currentState = EnemyState.Roaming;
                    }
                    else
                    {
                        yield return(0);
                    }
                }
                break;

            case EnemyState.Roaming:
                distanceToTarget = Vector3.Distance(playerTransform.position, thisTransform.position);

                if (distanceToTarget <= searchRange)
                {
                    currentState = EnemyState.Searching;
                }
                else
                {
                    Roam();
                }

                break;

            case EnemyState.Searching:
                distanceToTarget = Vector3.Distance(playerTransform.position, thisTransform.position);

                if (distanceToTarget <= searchRange)                                // SI distancia al objetivo es menor que el rango de busqueda..
                {
                    if (distanceToTarget <= attackRange)
                    {
                        ChasePlayer(AttackSpeed);                        // si está dentro de rango de ataque..
                    }
                    else
                    {
                        ChasePlayer(moveSpeed);                                                         // sino continuar rastreandolo a velocidad normal
                    }
                }
                else
                {
                    GoHome();                                                   // Volver a casa! ( cambia dirección de lado y avanzar indefinidamente..
                }
                break;

            case EnemyState.Hooked:
                if (Input.anyKeyDown || Managers.Game.InputLeft || Managers.Game.InputRight ||
                    Managers.Game.InputDown || Managers.Game.InputUp || Input.GetButtonDown("Fire1") ||
                    Input.GetButtonDown("Fire2") || Input.GetButtonDown("Jump"))
                {
                    ReleaseKeys++;
                }

                thisTransform.position += (Vector3.up * Mathf.Sin(Time.time * 15) * Time.deltaTime);

                orientation = playerControl.orientation;
                aniPlay.PlayFramesFixed(5, 2, 2, orientation, 1);

                timeLapse -= Time.deltaTime;

                if (ReleaseKeys > 30 || timeLapse <= 0)
                {
                    BeatDown();
                }

                break;

            case EnemyState.Holded:
                thisTransform.position = playerTransform.position + HoldedPosition;             // Update own hold position & player's too
                BeingHolded();
                break;

            case EnemyState.Shooted:
                if (playerTransform)
                {
                    if (thisTransform.IsChildOf(playerTransform))                                                               // check if the player has taken us...
                    {
                        currentState = EnemyState.Holded;                                                                       // & change enemy state to holded..
                    }
                }
                thisTransform.RotateAround(Vector3.forward, -orientation * 45 * Time.deltaTime);
                break;

            case EnemyState.Dead:
                if (playerTransform)
                {
                    if (thisTransform.IsChildOf(playerTransform))                                                               // check if the player has taken us...
                    {
                        currentState = EnemyState.Holded;                                                                       // & change enemy state to holded..
                    }
                }
                thisTransform.RotateAround(Vector3.forward, -orientation * 45 * Time.deltaTime);
                break;
            }


            if ((!OnWater && (int)currentState < 3) || (int)currentState > 5)      //&& ((int)enemyState < 3))
            {
                velocity.y -= gravity * Time.deltaTime;
            }

            thisTransform.position += velocity * Time.deltaTime;

            if (thisTransform.position.y < 0 && thisTransform != null)
            {
                Destroy(gameObject, 2);
            }

            yield return(0);
        }
    }
Beispiel #9
0
    IEnumerator CoUpdate()
    {
        while (thisTransform)
        {
            if (!target)
            {
                if (Managers.Game.PlayerPrefab)
                {
                    target = Managers.Game.PlayerPrefab.transform;
                    linkToPlayerControls = (PlayerControls)target.GetComponent <PlayerControls>();
                }
                else
                {
                    yield return(0);
                }
            }

            if (target)
            {
                if (thisTransform.IsChildOf(target))                                            // check if the player has taken us...
                {
                    thisTransform.position = target.position + HoldedPosition;                  // Update own hold position & player's too
                    enemyState             = ShooterState.Holded;                               // & change enemy state to holded..
                }
            }

            switch (enemyState)                         // check states of the character:
            {
            case ShooterState.Alert:                    // 1# ALERT STATE:
                animPlay.PlayFramesFixed(3, 0, 4, orientation);
                velocity    = Vector3.zero;
                velocity.x  = Mathf.Sin(Time.time);
                orientation = (int)Mathf.Sign(Mathf.Sin(Time.time));
                break;

            case ShooterState.Holded:                   // 3# ENEMY IS TAKEN
                BeingHolded();

                break;

            case ShooterState.Shooted:                  // 4# ENEMY IS THROWED IN THE AIR
                thisTransform.RotateAround(Vector3.forward, -orientation * 2 * Time.deltaTime);

                break;

            case ShooterState.Dead:                     // 5# ENEMY IS DEAD
                animPlay.PlayFramesFixed(0, 3, 1, orientation);
                thisTransform.RotateAround(Vector3.forward, -orientation * 45 * Time.deltaTime);
                grounded = false;
                break;
            }

            if (!grounded)
            {
                velocity.y -= gravity * Time.deltaTime;
            }
            thisTransform.position += velocity * Time.deltaTime;

            if (thisTransform.position.y < 0 && thisTransform != null)
            {
                Destroy(gameObject, 2);                                                         // If character falls get it up again
            }
            yield return(0);
        }
    }
Beispiel #10
0
        //void Update()
        //{
        //    switch (currentType)
        //    {
        //        case AnimationType.Default:
        //            simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
        //            break;

        //        case AnimationType.Bird:
        //            simpleAnim.PlayFramesFixed(RowStart, ColumnStart, TotalFrames, Orientation);
        //            thisTransform.position += Vector3.up * Mathf.Sin(Time.time *3) * Time.deltaTime;
        //            break;
        //        case AnimationType.Fire:
        //            simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
        //            counter += Time.deltaTime * 2;
        //            renderer.material.SetFloat("_KeyY", counter);

        //            counter %= 1;
        //            //counter = Mathf.Repeat(counter, 1);
        //            break;

        //        case AnimationType.Water:
        //            simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
        //            break;
        //    }
        //}

        IEnumerator CoUpdate()
        {
            while (true)
            {
                switch (currentType)
                {
                case AnimationType.Default:
                    simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
                    break;

                case AnimationType.Bird:
                    simpleAnim.PlayFramesFixed(RowStart, ColumnStart, TotalFrames, Orientation);
                    thisTransform.position += Vector3.up * Mathf.Sin(Time.time * 3) * Time.deltaTime;
                    break;

                case AnimationType.Fire:
                    //simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
                    //counter += Time.deltaTime * 2;
                    //renderer.material.SetFloat("_KeyY", counter);

                    ////counter %= 1;
                    //counter = Mathf.Repeat(counter, 1);

                    simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
                    renderer.material.SetFloat("_KeyY", Managers.Display.PaletteSwap);

                    break;

                case AnimationType.RaveLight:
                    simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation, 30);
                    thisTransform.RotateAround(InitPos + Vector3.up, Vector3.forward, Mathf.Sin(Time.time));
                    break;

                case AnimationType.RaveGaucho1:
                    thisTransform.position += Vector3.right * Mathf.Sin(Time.time * 3) * 2 * Time.deltaTime;
                    simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, (int)-Mathf.Sign(Mathf.Sin(Time.time * 3)));
                    break;

                case AnimationType.RaveGaucho2:
                    if (Mathf.Sin(Time.time) > 0)
                    {
                        simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, (int)Mathf.Sign(Mathf.Sin(Time.time * 3)), 9);
                    }
                    else
                    {
                        simpleAnim.PlayFrames(1, 0, 2, (int)Mathf.Sign(Mathf.Sin(Time.time * 5)), 9);
                    }

                    break;

                case AnimationType.MateGaucho:
                    if (Managers.Register.Treasure2)
                    {
                        GameObject Gaucho = null;
                        if (Random.Range(0, 100) > 50)
                        {
                            Gaucho = (GameObject)Instantiate(Resources.Load("Prefabs/Gaucho", typeof(GameObject)),
                                                             transform.position, transform.rotation);
                        }
                        else
                        {
                            Gaucho = (GameObject)Instantiate(Resources.Load("Prefabs/GauchoFacon", typeof(GameObject)),
                                                             transform.position, transform.rotation);
                        }
                        Gaucho.transform.parent = Managers.Tiled.MapTransform;
                        Destroy(gameObject);
                    }
                    else
                    {
                        simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
                    }
                    break;

                case AnimationType.Kurupi:

                    if (Managers.Game.PlayerPrefab != null)
                    {
                        if (Managers.Game.PlayerPrefab.transform.position.x > thisTransform.position.x)
                        {
                            Orientation = -1;
                        }
                        else
                        {
                            Orientation = 1;
                        }
                    }

                    if (Mathf.Sin(Time.time) > 0)
                    {
                        simpleAnim.PlayFrames(RowStart, ColumnStart, TotalFrames, Orientation);
                    }
                    else
                    {
                        simpleAnim.PlayFrames(RowStart, ColumnStart + 1, TotalFrames, Orientation);
                    }

                    if (Managers.Register.MboiTuiDefeated)
                    {
                        Destroy(thisTransform.gameObject);
                    }

                    break;

                case AnimationType.Water:

                    renderer.material.mainTextureOffset = Managers.Display.WaterFlow;           // texture offset
                    renderer.material.mainTextureScale  = new Vector3(.125f, .125f);            // texture scale

                    break;

                case AnimationType.WaterAlpha:

                    renderer.material.mainTextureOffset = Managers.Display.WaterFlowAlpha;      // texture offset
                    renderer.material.mainTextureScale  = new Vector3(.125f, .125f);            // texture scale

                    break;
                }

                yield return(0);
            }
        }
Beispiel #11
0
    IEnumerator CoUpdate()
    {
        while (thisTransform)
        {
            //if (playerTransform)


            switch (currentState)
            {
            case EnemyState.StandBy:
                if (!playerTransform)
                {
                    if (Managers.Game.PlayerPrefab)
                    {
                        playerTransform = Managers.Game.PlayerPrefab.transform;                                 //	We can Use this system to get the player's Id & position
                        playerControl   = playerTransform.GetComponent <PlayerControls>();
                        //playerProps = playerTransform.GetComponent<PlayerProperties>();
                        currentState = EnemyState.Roaming;
                    }
                    else
                    {
                        yield return(0);
                    }
                }
                break;

            case EnemyState.Roaming:
                distanceToTarget = Vector3.Distance(playerTransform.position, thisTransform.position);

                if (distanceToTarget <= searchRange)                                // SI distancia al objetivo es menor que el rango de busqueda..
                {
                    if (distanceToTarget <= attackRange &&   //)
                        thisTransform.position.y >= playerTransform.position.y + 1)                                 // si está dentro de rango de ataque..
                    {
                        currentState = EnemyState.Attacking;                                                        // acelerar la velocidad de ataque
                    }
                    else
                    {
                        ChasePlayer();                                                          // sino continuar rastreandolo a velocidad normal
                    }
                }
                else                                                                                        // SINO chequear rutina habitual de comportamiento cuando está solo...
                {
                    GoHome();                                                                               // Volver a casa! ( cambia dirección de lado y avanzar indefinidamente..
                }
                break;

            case EnemyState.Attacking:
                AttackPlayer();
                break;

            case EnemyState.Hooked:
                if (Input.anyKeyDown || Managers.Game.InputLeft || Managers.Game.InputRight ||
                    Managers.Game.InputDown || Managers.Game.InputUp || Input.GetButtonDown("Fire1") ||
                    Input.GetButtonDown("Fire2") || Input.GetButtonDown("Jump"))
                {
                    ReleaseKeys++;
                }

                //if (Time.time > timeLapse)
                //{
                //    timeLapse = Time.time + 3;
                //    collider.enabled = true;
                //}

                //thisTransform.position = playerTransform.position;
                //thisTransform.position += (Vector3.up * Mathf.Sin(Time.time * 5) * 3 * Time.deltaTime);
                thisTransform.position += (Vector3.up * Mathf.Sin(Time.time * 15) * Time.deltaTime);

                orientation = playerControl.orientation;
                //aniPlay.PlayFrames(5, 5, 2, orientation);
                aniPlay.PlayFramesFixed(5, 5, 2, orientation, 1);

                timeLapse -= Time.deltaTime;

                if (ReleaseKeys > 30 || timeLapse <= 0)
                {
                    BeatDown();
                }

                break;

            case EnemyState.Holded:
                thisTransform.position = playerTransform.position + HoldedPosition;             // Update own hold position & player's too
                BeingHolded();
                break;

            case EnemyState.Shooted:
                if (playerTransform)
                {
                    if (thisTransform.IsChildOf(playerTransform))                                                               // check if the player has taken us...
                    {
                        currentState = EnemyState.Holded;                                                                       // & change enemy state to holded..
                    }
                }
                thisTransform.RotateAround(Vector3.forward, -orientation * 45 * Time.deltaTime);
                velocity.y             -= gravity * Time.deltaTime;
                thisTransform.position += velocity * Time.deltaTime;

                break;

            case EnemyState.Dead:
                if (playerTransform)
                {
                    if (thisTransform.IsChildOf(playerTransform))                                                               // check if the player has taken us...
                    {
                        currentState = EnemyState.Holded;                                                                       // & change enemy state to holded..
                    }
                }
                thisTransform.RotateAround(Vector3.forward, -orientation * 45 * Time.deltaTime);
                velocity.y             -= gravity * Time.deltaTime;
                thisTransform.position += velocity * Time.deltaTime;

                if (thisTransform.position.y < 0 && thisTransform != null)
                {
                    Destroy(gameObject, 2);     // If character falls get it up again
                }
                break;
            }

            yield return(0);
        }
    }
Beispiel #12
0
    void ControlAuto()
    {
        isHoldingObj = System.Convert.ToByte(properties._pickedObject != null);
        bool Stand = Physics.Linecast(thisTransform.position, thisTransform.TransformPoint(-Vector3.up), layerMask);

        Collider.center = Vector3.zero;

        if (controller.isGrounded)
        {
            runJumpEnable = false;

            velocity = new Vector3(Input.GetAxis("Horizontal"), 0, 0);

            if (Input.GetAxis("Horizontal") == 0)                                                                       // IDLE -> keep stand quiet
            {
                animPlay.PlayFramesFixed(2 + isHoldingObj, 0, 1, orientation);
            }

            if (Input.GetAxis("Horizontal") != 0)                                       // WALK
            {
                orientation = (int)(Mathf.Sign(velocity.x));                            // If move direction changes -> flip sprite

                velocity.x *= walkSpeed;                                                // If player is moving ->  Animate Walking..
                animPlay.PlayFramesFixed((0 + isHoldingObj), 0, 8, orientation);
            }

            if ((Mathf.Abs(Input.GetAxis("Horizontal")) >= 1) && !Input.GetButton("Fire1") && !Managers.Dialog.IsInConversation())                                              // RUN
            {
                velocity *= runSpeed;
                animPlay.PlayFramesFixed(2, 1, 2, orientation, 1.005f);
            }

            if (velocity.x == 0 && Input.GetAxisRaw("Vertical") < 0 && !Managers.Dialog.IsInConversation())     // Crouch
            {
                animPlay.PlayFrames(3, 3, 1, orientation);
                Collider.center = Vector3.down * 0.25f;
            }


            if (Input.GetButtonDown("Jump"))                                                     // Always running jump
            {
                velocity.y = runJump;
                //Instantiate ( particleJump, particlePlacement, transform.rotation );
                Managers.Audio.Play(JumpSound, thisTransform, 1.0f, 0.75f);
                runJumpEnable = true;
            }
        }

        if (Input.GetButtonDown("Jump") && Stand)                   // slope jump
        {
            velocity.y = walkJump;
            Managers.Audio.Play(JumpSound, thisTransform, 1.0f, 1.25f);
            runJumpEnable = true;
        }

        if (!controller.isGrounded && !Stand)   // && !Stand	    // Do Slide
        {
            velocity.x = Input.GetAxis("Horizontal");
            //animPlay.PlayFrames ( 2, 5, 1, orientation );

            if (Input.GetButtonUp("Jump"))                                              // check if the player keep pressing jump button..
            {
                velocity.y *= fallSpeed;                                                // if not then brake the jump
            }
            if (velocity.x != 0)
            {
                orientation = (int)Mathf.Sign(velocity.x);                      // If move direction changes -> update & flip sprite
            }
            if (runJumpEnable)
            {
                velocity.x *= runSpeed;
                animPlay.PlayFrames(2 + isHoldingObj, 4, 1, orientation);
            }

            if (velocity.y < 0 && !Stand)                                               // check when player stops elevation & becomes down..
            {
                animPlay.PlayFrames(2 + isHoldingObj, 5, 1, orientation);

                if (Input.GetButton("Jump") && isHoldingObj == 0) // check if the player keep pressing jump button..
                {
                    velocity.y += 18 * Time.deltaTime;
                    animPlay.PlayFrames(2, 6, 2, orientation);
                }
            }
        }

        if (controller.collisionFlags == CollisionFlags.Above)
        {
            velocity.y  = 0;                                                            // set velocity on Y to 0, stop upward motion
            velocity.y -= afterHitForceDown;                                            // apply force downward so player doesn't have in the air
        }

        if (properties.BurnOut)
        {
            BurnOut();
        }

        velocity.y -= gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);

        var Pos = thisTransform.position;

        Pos.z = Depth;
        thisTransform.position = Pos;
        thisTransform.rotation = Quaternion.Euler(0, 0, 0);
    }