Пример #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerController controller = GetComponent <PlayerController>();

        if (controller == null)
        {
            return;                    //only handle collisions by ME
        }
        //Debug.Log($"!!!!!!!!!!!!!!!!!!!!!!!Player collided. Name: {collision.name}. GameObj Name: {collision.gameObject.name}!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        //Player player = collision.gameObject.GetComponent<Player>();
        if (collision.name == "HealthBoost")
        {
            Debug.Log("Health");
            ClientSend.BoostHandle(0, collision.gameObject.transform.position);
        }
        else if (collision.name == "PlayerSpeedBoost")
        {
            Debug.Log("Speed");
            ClientSend.BoostHandle(1, collision.gameObject.transform.position);
        }
        else if (collision.name == "BulletSpeedBoost")
        {
            Debug.Log("B Speed");
            controller.bulletSpeedMultiplier += 1f;
            controller.ResetBulletSpeedMultiplierDelayed(PlayerController.multiplierDuration);
            ClientSend.BoostHandle(2, collision.gameObject.transform.position);
        }
        else if (collision.name == "BulletDamageBoost")
        {
            Debug.Log("Damage");
            ClientSend.BoostHandle(3, collision.gameObject.transform.position);
        }
    }