using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Plateformes : MonoBehaviour
{
    public float speed;
    private Rigidbody rbPlateforme;

    void Start()
    {
        rbPlateforme = transform.GetComponent<Rigidbody>();
    }

    void OnTriggerEnter(Collider collidedWithThis)
    {
        Rigidbody rbPlayer = collidedWithThis.gameObject.GetComponent<Rigidbody>();

        if (collidedWithThis.transform.tag == "Player")
        {
            rbPlayer.velocity = transform.up * speed;
        }

        if (gameObject.tag == "BonusFusee")
        {
            Perso perso = collidedWithThis.gameObject.GetComponent<Perso>();
            if (perso != null)
            {
                perso.BonusFusee();
            }
        }
    }
}
