Пример #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        PlayerController_v3 ctl = collision.collider.GetComponent <PlayerController_v3>();

        need_to_synchronization = (ctl != null);
        controller = ctl;
    }
Пример #2
0
    //private void OnTriggerEnter2D(Collider2D collision)
    //{
    //    PlayerController_v3 ctl = collision.GetComponent<PlayerController_v3>();
    //    if (ctl != null)
    //    {
    //        // some animation
    //    }
    //}
    private void OnTriggerStay2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            if (Input.GetKey(KeyToMove))
            {
                right_dir           = false;
                ctl.set_drag_dir    = rigidbody2d.position.x - ctl.GetComponent <Rigidbody2D>().position.x;
                ctl.drag_dbf_change = Character_Speed_Debuff;
                ctl.drag_status_set = true;
                float amplify = 1;
                if ((rigidbody2d.position.x - ctl.GetComponent <Rigidbody2D>().position.x) > 0 && ctl.mov_pos.x < 0)
                {
                    amplify = move_amplification;
                    if (!Mathf.Approximately(ctl.mov_pos.x, 0))
                    {
                        right_dir            = true;
                        post_force_direction = Mathf.Sign(ctl.mov_pos.x);
                    }
                }
                if (rigidbody2d.position.x - ctl.GetComponent <Rigidbody2D>().position.x < 0 && ctl.mov_pos.x > 0)
                {
                    amplify = move_amplification;
                    if (!Mathf.Approximately(ctl.mov_pos.x, 0))
                    {
                        right_dir            = true;
                        post_force_direction = Mathf.Sign(ctl.mov_pos.x);
                    }
                }
                if (Mathf.Approximately(rigidbody2d.velocity.x, 0))
                {
                    rigidbody2d.velocity = new Vector2(0, rigidbody2d.velocity.y);
                }
                else
                {
                    rigidbody2d.MovePosition(rigidbody2d.position + new Vector2(ctl.mov_pos.x * amplify, 0));
                }
            }
            else
            {
                ctl.drag_status_set = false;
            }
            lock_is_set = !Input.GetKey(KeyToMove);
            if (!lock_is_set)
            {
                lock_is_set = ctl.get_flight_status;
            }
            if ((collision.attachedRigidbody.position.y - rigidbody2d.position.y) > 1.0)
            {
                ctl.drag_status_set = false;
                lock_is_set         = true;
            }
            if (!Input.GetKey(KeyToMove))
            {
                rigidbody2d.velocity = new Vector2(0, 0);
            }
        }
    }
Пример #3
0
 public void EtapPass(Collision2D collision, string Etap)
 {
     BkgAndTimeStop(true);
     Playerctl = collision.collider.GetComponent <PlayerController_v3>();
     ScoreTableCnt.UpdateValueIfGreatherViaInnerKeys(Playerctl.GetTimePlayed, Etap);
     ResCnvCtl.FillResTableByEtaps(GetEtapsID(), SceneManager.GetActiveScene().name);
     ResCnvCtl.SetVisibility(true);
 }
Пример #4
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            animator.SetBool("Active", false);
        }
    }
Пример #5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            Destroy(gameObject);
        }
    }
Пример #6
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            ctl.SetIinvulnerableTime = Time.fixedTime + Invulnerable_time;
            Destroy(gameObject);
        }
    }
Пример #7
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            ctl.ladder_stun_setter = false;
            ctl.ladder_set         = false;
            last_exit_time         = Time.fixedTime;
        }
    }
Пример #8
0
    private void OnCollisionStay2D(Collision2D collision)
    {
        PlayerController_v3 ctl = collision.collider.GetComponent <PlayerController_v3>();

        remote_ctl = (ctl != null);
        controller = ctl;
        //if(ctl!= null)
        //{
        //    ctl.Remote_mov_v2_s = mov;
        //}
    }
Пример #9
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            ctl.speed = speed_boost_set_value;
            ctl.set_speed_boost_time = speed_boost_duration;
            Destroy(gameObject);
        }
    }
Пример #10
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            if (!pass)
            {
                TTD_timer = time_to_print_dlg;
            }
        }
    }
Пример #11
0
    public void FinalViaCollider(Collider2D collision)
    {
        Time.timeScale = 0;
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        FinalCnv.GetComponentInChildren <Text>().text = String.Format(FinalTxt, ctl.GetTimePlayed.ToString("F2"));
        FinalCnv.SetActive(true);
        BkgCnv.SetActive(true);
        string FinalEtap = GameObject.Find("Collectibles").GetComponent <Collectibles_ctl>().GetLastEtap;

        ScoreTableCnt.UpdateValueIfGreatherViaInnerKeys(ctl.GetTimePlayed, FinalEtap);
    }
Пример #12
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            if (!ctl.check_max_hp_status)
            {
                ctl.Add_Health(health_restore);
                Destroy(gameObject);
            }
        }
    }
Пример #13
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            if ((Time.fixedTime - last_exit_time) < anti_jitter_cooldown)
            {
                ctl.ladder_stun_setter = true;
            }
            ctl.ladder_set  = true;
            ctl.y_speed_set = 0.0f;
        }
    }
Пример #14
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        PlayerController_v3 ctl = collision.GetComponent <PlayerController_v3>();

        if (ctl != null)
        {
            lock_is_set = true;
            if (Input.GetKey(KeyToMove))
            {
                rigidbody2d.velocity = new Vector2(0, 0);
                apply_post_force     = right_dir;
            }
            ctl.drag_status_set = false;
        }
    }
Пример #15
0
 private void OnCollisionExit2D(Collision2D collision)
 {
     remote_ctl = false;
     controller = null;
 }