Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            plCollider = other.GetComponent <Collider>();
            plRigid    = other.GetComponent <Rigidbody>();
            playerMat  = plCollider.material;
            stateRef   = plCollider.GetComponent <script_managerRebotes>();

            playerMat.bounciness = 0f;

            plCollider.material = playerMat;
        }
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        selfColl       = GetComponent <Collider>();
        selfPhysicsMat = selfColl.material;
        selfRigid      = GetComponent <Rigidbody>();

        float   solveAngle     = angle * Mathf.Deg2Rad;
        Vector3 directionLunch = new Vector3(Mathf.Cos(solveAngle), Mathf.Sin(solveAngle), 0f);

        selfRigid.AddForce(directionLunch * fuerza, ForceMode.Force);

        currentType = (TiposChoque)Random.Range(0, 2);
    }