// Token: 0x0600207D RID: 8317 RVA: 0x00094A78 File Offset: 0x00092C78
 public void OnCollision(Collision collision)
 {
     for (int i = 0; i < collision.contacts.Length; i++)
     {
         ContactPoint contactPoint = collision.contacts[i];
         Vector2      vector       = base.WorldToLocal(contactPoint.normal);
         if (PlatformMovement.IsWallLeft(vector, contactPoint.otherCollider, 30f))
         {
             base.OnCollisionWallLeft(vector, contactPoint.otherCollider);
         }
         if (PlatformMovement.IsWallRight(vector, contactPoint.otherCollider, 30f))
         {
             base.OnCollisionWallRight(vector, contactPoint.otherCollider);
         }
         if (PlatformMovement.IsGround(vector, contactPoint.otherCollider, 60f))
         {
             this.m_groundContactNormal += vector;
             base.OnCollisionGround(vector, contactPoint.otherCollider);
         }
         if (PlatformMovement.IsCeiling(vector, contactPoint.otherCollider, 60f))
         {
             base.OnCollisionCeiling(vector, contactPoint.otherCollider);
         }
     }
 }
Example #2
0
    // Token: 0x06001074 RID: 4212 RVA: 0x000623AC File Offset: 0x000605AC
    public bool CanWallDash()
    {
        PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;
        bool             flag             = (platformMovement.HasWallLeft && this.m_sein.Input.Horizontal >= 0f) || (platformMovement.HasWallRight && this.m_sein.Input.Horizontal <= 0f);

        return(flag && !this.m_sein.IsOnGround && this.m_sein.PlayerAbilities.AirDash.HasAbility);
    }
    void FixedUpdate()
    {
        var colliders = Physics.OverlapBox(transform.position, transform.localScale / 2, Quaternion.identity, groundLayer);

        //If player is in the air OR only in the trigger part of a platform
        if ((colliders.Length == 0 || colliders.All(c => c.isTrigger)) && !isCollidingWithButton && !isCollidingWithGoal)
        {
            transform.Rotate(Vector3.back * 5f * dir);
        }
        else
        {
            var collider = colliders.FirstOrDefault(p => p?.gameObject?.tag == platform.tag);
            platformMovement = collider?.GetComponent <PlatformMovement>();

            StopRotation(collider);

            if (platformMovement == null)
            {
                return;
            }


            rb.velocity = platformMovement.velocity;
            dir         = platformMovement.direction;
        }
    }
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (m_movingPlatformLayer == (m_movingPlatformLayer | (1 << collision.gameObject.layer)))
     {
         currentMovingPlatform = collision.gameObject.GetComponent <PlatformMovement>();
         onMovingPlatform      = true;
     }
 }
 public void AddTile(PlatformMovement platformMovement)
 {
     _platforms.Add(platformMovement);
     if (IsStarted)
     {
         platformMovement.Init();
     }
 }
 private void OnCollisionExit2D(Collision2D collision)
 {
     if (m_movingPlatformLayer == (m_movingPlatformLayer | (1 << collision.gameObject.layer)))
     {
         currentMovingPlatform = null;
         onMovingPlatform      = false;
     }
 }
Example #7
0
    // Token: 0x0600107B RID: 4219 RVA: 0x00062AB4 File Offset: 0x00060CB4
    public void StopDashing()
    {
        PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;

        platformMovement.LocalSpeed = Vector2.zero;
        this.ChangeState(SeinDashAttack.State.Normal);
        this.m_stopAnimation      = true;
        this.m_chargeDashAtTarget = false;
    }
    // Token: 0x0600107D RID: 4221
    public void UpdateDashing()
    {
        PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;

        UI.Cameras.Current.ChaseTarget.CameraSpeedMultiplier.x = Mathf.Clamp01(this.m_stateCurrentTime / this.DashTime);
        float velocity = this.DashSpeedOverTime.Evaluate(this.m_stateCurrentTime);

        velocity *= 1.0f + .2f * RandomizerBonus.Velocity();
        if ((RandomizerBonus.GravitySuit() && Characters.Sein.Abilities.Swimming.IsSwimming))
        {
            Vector2 newSpeed = new Vector2(velocity, 0f);
            platformMovement.LocalSpeed = newSpeed.Rotate(this.m_sein.Abilities.Swimming.SwimAngle);
        }
        else
        {
            platformMovement.LocalSpeedX = (float)((!this.m_faceLeft) ? 1 : -1) * velocity;
        }
        this.m_sein.FaceLeft = this.m_faceLeft;
        if (this.AgainstWall())
        {
            platformMovement.LocalSpeed = Vector2.zero;
        }
        this.SpriteRotation = Mathf.Lerp(this.SpriteRotation, this.m_sein.PlatformBehaviour.PlatformMovement.GroundAngle, 0.2f);
        if (this.m_sein.IsOnGround)
        {
            if (Core.Input.Horizontal > 0f && this.m_faceLeft)
            {
                this.StopDashing();
            }
            if (Core.Input.Horizontal < 0f && !this.m_faceLeft)
            {
                this.StopDashing();
            }
        }
        if (this.m_stateCurrentTime > this.DashTime)
        {
            if (platformMovement.IsOnGround && Core.Input.Horizontal == 0f)
            {
                platformMovement.LocalSpeedX = 0f;
            }
            this.ChangeState(SeinDashAttack.State.Normal);
        }
        if (Core.Input.Jump.OnPressed || Core.Input.Glide.OnPressed)
        {
            platformMovement.LocalSpeedX = ((!this.m_faceLeft) ? this.OffGroundSpeed : (-this.OffGroundSpeed));
            this.m_sein.PlatformBehaviour.AirNoDeceleration.NoDeceleration = this.m_allowNoDecelerationForThisDash;
            this.m_stopAnimation = true;
            this.ChangeState(SeinDashAttack.State.Normal);
            this.m_timeWhenDashJumpHappened = Time.time;
        }
        if (this.RaycastTest() && this.m_isOnGround)
        {
            this.StickOntoGround();
            return;
        }
        this.m_isOnGround = false;
    }
Example #9
0
    void Awake()
    {
        platform = gameObject.GetComponent <PlatformMovement>();

        if (transform.position.x < 0)
        {
            pan = -1f;
        }
    }
    // Token: 0x0600107F RID: 4223
    public void UpdateChargeDashing()
    {
        PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;

        this.AttackNearbyEnemies();
        this.m_sein.Mortality.DamageReciever.MakeInvincibleToEnemies(1f);
        float velocity = this.ChargeDashSpeedOverTime.Evaluate(this.m_stateCurrentTime);

        velocity *= 1.0f + .2f * RandomizerBonus.Velocity();
        if (this.m_chargeDashAtTarget)
        {
            platformMovement.LocalSpeed = this.m_chargeDashDirection * velocity;
        }
        else
        {
            platformMovement.LocalSpeedX = (float)((!this.m_faceLeft) ? 1 : -1) * velocity;
        }
        if (this.m_hasHitAttackable)
        {
            platformMovement.LocalSpeed *= 0.33f;
        }
        this.m_sein.FaceLeft = this.m_faceLeft;
        this.SpriteRotation  = Mathf.Lerp(this.SpriteRotation, this.m_sein.PlatformBehaviour.PlatformMovement.GroundAngle, 0.3f);
        if (this.AgainstWall())
        {
            platformMovement.LocalSpeed = Vector2.zero;
        }
        if (this.m_sein.IsOnGround)
        {
            if (Core.Input.Horizontal > 0f && this.m_faceLeft)
            {
                this.StopDashing();
            }
            if (Core.Input.Horizontal < 0f && !this.m_faceLeft)
            {
                this.StopDashing();
            }
        }
        if (this.m_stateCurrentTime > this.ChargeDashTime)
        {
            this.ChangeState(SeinDashAttack.State.Normal);
        }
        if (Core.Input.Jump.OnPressed || Core.Input.Glide.OnPressed)
        {
            platformMovement.LocalSpeedX = ((!this.m_faceLeft) ? this.OffGroundSpeed : (-this.OffGroundSpeed));
            this.m_sein.PlatformBehaviour.AirNoDeceleration.NoDeceleration = true;
            this.m_stopAnimation = true;
            this.ChangeState(SeinDashAttack.State.Normal);
        }
        if (this.RaycastTest() && this.m_isOnGround && !this.m_chargeDashAtTarget)
        {
            this.StickOntoGround();
            return;
        }
        this.m_isOnGround = false;
    }
Example #11
0
    public void Move()
    {
        move = false;
        PlatformMovement movement = movements[currMovement];
        Vector3          endPos   = transform.position + movement.offset;

        StartCoroutine(MovementUtils.SmoothMovement((bool done) => {
            move = true;
        }, gameObject, endPos, movement.speed));
    }
Example #12
0
    void MovingDown()
    {
        gameObject.transform.position += Vector3.down * speed * Time.deltaTime;

        if (gameObject.transform.position.y < yDown)
        {
            gameObject.transform.position = new Vector3(gameObject.transform.position.x, yDown, gameObject.transform.position.z);
            platformMovement = PlatformMovement.Down;
        }
    }
Example #13
0
    void MovingUp()
    {
        gameObject.transform.position += Vector3.up * speed * Time.deltaTime;

        if (gameObject.transform.position.y > yUp)
        {
            gameObject.transform.position = new Vector3(gameObject.transform.position.x, yUp, gameObject.transform.position.z);
            platformMovement = PlatformMovement.Up;
        }
    }
Example #14
0
 private void newRound()
 {
     //reset the bullet count
     Wave.bulletCount = 0;
     Wave.setWave(Wave.getWave() + 1);
     Score.scoreMultiplier = Wave.getWave();
     speed += 5;
     PlatformMovement.setSpeed(PlatformMovement.getSpeed() + 1.3f);
     PlatformSpawn.setDelay(PlatformSpawn.getDelay() - 0.3f);
     GenerateBullets.setDelay(GenerateBullets.getDelay() - 0.2f);
 }
Example #15
0
 public static void reset()
 {
     //reset all
     setWave(1);
     bulletCount    = 0;
     Score.scoreNum = 0;
     PlatformMovement.setSpeed(2);
     BulletMovement.speed  = 10;
     Score.scoreMultiplier = getWave();
     PlatformSpawn.setDelay(2);
     GenerateBullets.setDelay(2);
 }
Example #16
0
    void Awake()
    {
        platform     = gameObject.GetComponent <PlatformMovement>();
        platformXPos = transform.position.x;

        if (transform.position.x < 0)
        {
            pan = -1f;
        }

        if (ball == null)
        {
            Debug.LogError("Укажи первый мяч для бота!");
        }

        difficulty = GameData.instance.difficulty;

        switch (difficulty)
        {
        case 1:
            reactTime = 0.6f;
            break;

        case 2:
            reactTime = 0.40f;
            break;

        case 3:
            reactTime = 0.45f;
            break;

        default:
            Debug.LogError("difficulty did set up!");
            break;
        }

        ballVelocity = ball.GetComponent <Rigidbody2D>().velocity;
        ballRadius   = ball.GetComponent <CircleCollider2D>().radius / 2;

        GameEvents.current.onBallDestroy += OnBallDestroy;
        GameEvents.current.onBallSpawn   += OnBallSpawn;
        GameEvents.current.onPlayerSave  += OnPlayerSave;

        if (difficulty == 3)
        {
            GameEvents.current.onBotSave += OnBotSave;
        }

        print(difficulty);
    }
    // Token: 0x06003220 RID: 12832
    public IEnumerator MoveSeinToCenterSmoothly()
    {
        PlatformMovement seinPlatformMovement = Characters.Sein.PlatformBehaviour.PlatformMovement;
        int num;

        for (int i = 0; i < 10; i = num + 1)
        {
            seinPlatformMovement.PositionX = Mathf.Lerp(seinPlatformMovement.PositionX, base.transform.position.x, 0.2f);
            yield return(new WaitForFixedUpdate());

            num = i;
        }
        seinPlatformMovement.PositionX = base.transform.position.x;
        yield break;
    }
Example #18
0
    internal void Init()
    {
        GameManager gm = GameObject.Find("Manager").GetComponent <GameManager>();

        platMovement = GameObject.Find("MovingObjects").GetComponent <PlatformMovement>();
        platEmitter  = GameObject.Find("PlatformEmitter").GetComponent <PlatformEmitter>();
        fallPoint    = GameObject.Find("FallPoint").GetComponent <PlatformFall>();

        if (presetModel == null)
        {
            gm.SpawnPlayer();
            //player = GameObject.FindGameObjectWithTag("Player");
        }
        else
        {
            CameraColorShift.brightness = presetModel.brightness;
            CameraColorShift.contrast   = presetModel.contrast;
            CameraColorShift.saturation = presetModel.saturation;
            CameraColorShift.hue        = presetModel.hue;
            platEmitter.columnCount     = presetModel.platStreamWidth;
            platEmitter.multiplePaths   = presetModel.multiplePaths;
            platMovement.speed          = presetModel.platSpeed;
            if (presetModel.textures == 0)
            {
                borderMat = 3; groundMat = 11; towerMat = 1; platMat = 8;
            }
            else if (presetModel.textures == 1)
            {
                borderMat = 4; groundMat = 6; towerMat = 9; platMat = 3;
            }
            else
            {
                borderMat = 2; groundMat = 7; towerMat = 8; platMat = 0;
            }
            SetMaterials();
            gm.SetPlayerObject();
            gm.SpawnPlayer();
        }
        timeAlive                    = 0f;
        playerIsAlive                = true;
        gm.trail                     = player.GetComponent <TrailRenderer>();
        playCtrl                     = player.GetComponent <PlayerController>();
        startJumpTime                = playCtrl.jumpTime;
        startPlatSpeed               = platMovement.speed;
        startFallSpeed               = fallPoint.fallSpeed;
        startDecJumpSpeed            = playCtrl.decreaseJumpBySpeed;
        playCtrl.decreaseJumpBySpeed = 1 + (startPlatSpeed * .02f);
    }
Example #19
0
    //allows player to move left + right
    private void PlayerMove()
    {
        //have an input from user
        var deltaX = Input.GetAxis("Horizontal");
        //Add the position where player is going to be and give them speed
        var newXPos = deltaX * speed;

        //Check if player is on platform if he is move with platform and if he wants to move then call move
        if (isGrounded == true)
        {
            rb.velocity = new Vector2(newXPos + PlatformMovement.getSpeed() * -1, rb.velocity.y);
        }
        else
        {
            rb.velocity = new Vector2(newXPos, rb.velocity.y);
        }
    }
    // Token: 0x0600107E RID: 4222
    private void StickOntoGround()
    {
        PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;
        Vector3          vector           = platformMovement.Position;

        platformMovement.PlaceOnGround(0f, 8f);
        Vector3 vector2 = vector;

        platformMovement.PlaceOnGround(0.5f, 8f);
        Vector3 vector3 = vector;

        vector = vector2;
        if (vector3.y > vector2.y)
        {
            vector = vector3;
        }
        platformMovement.Position = vector;
    }
 private void Awake()
 {
     platform = FindObjectOfType <PlatformMovement>();
 }
Example #22
0
 private void Start()
 {
     m_platformMovement = GetComponent <PlatformMovement>();
     m_platformDestroy  = GetComponent <PlatformDestroy>();
 }
Example #23
0
 void Lower()
 {
     platformMovement = PlatformMovement.GoingDown;
 }
Example #24
0
 void Raise()
 {
     platformMovement = PlatformMovement.GoingUp;
 }
    // Token: 0x06001076 RID: 4214
    public bool AgainstWall()
    {
        PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;

        return((platformMovement.HasWallLeft && this.m_sein.FaceLeft) || (platformMovement.HasWallRight && !this.m_sein.FaceLeft));
    }
    // Token: 0x0600107B RID: 4219
    public void UpdateNormal()
    {
        float num = Time.time - this.m_lastPressTime;

        if (this.m_sein.IsOnGround || (RandomizerBonus.GravitySuit() && Characters.Sein.Abilities.Swimming.IsSwimming))
        {
            this.m_hasDashed = false;
            RandomizerBonus.DoubleAirDashUsed = false;
        }
        if (Core.Input.Glide.Pressed && this.m_timeWhenDashJumpHappened + 5f > Time.time)
        {
            this.m_timeWhenDashJumpHappened = 0f;
            PlatformMovement platformMovement = this.m_sein.PlatformBehaviour.PlatformMovement;
            float            num2             = this.OffGroundSpeed - 2f;
            if (Mathf.Abs(platformMovement.LocalSpeedX) > num2)
            {
                platformMovement.LocalSpeedX = Mathf.Sign(platformMovement.LocalSpeedX) * num2;
            }
        }
        IChargeDashAttackable target;

        if (this.CanChargeDash())
        {
            target = this.FindClosestAttackable;
        }
        else
        {
            target = null;
        }
        this.UpdateTargetHighlight(target);
        if (Core.Input.RightShoulder.Pressed && num < 0.15f)
        {
            if (this.CanChargeDash())
            {
                if (this.HasEnoughEnergy)
                {
                    this.SpendEnergy();
                    this.PerformChargeDash();
                    return;
                }
                this.ShowNotEnoughEnergy();
                this.m_lastPressTime = 0f;
                return;
            }
            else
            {
                if (this.CanPerformNormalDash())
                {
                    this.PerformDash();
                    return;
                }
                if (this.CanWallDash())
                {
                    this.PerformWallDash();
                    return;
                }
                if (this.CanPerformDashIntoWall())
                {
                    this.PerformDashIntoWall();
                }
            }
        }
    }