Exemplo n.º 1
0
    private void ReverseGravity(Collider2D collision)
    {
        Color gravityColor = myParticleSystemRenderer.material.color;

        if (colorHandler.ColorContain(gravityColor))
        {
            float gravity = transform.rotation.z == 0f ? 1f : -1f;
            collision.gameObject.GetComponent <Rigidbody2D>().gravityScale = -gravity;
            AudioSource.PlayClipAtPoint(audioSource.clip, Camera.main.transform.position, PlayerPrefsController.GetSFXVolume() / 10f);
        }
    }
Exemplo n.º 2
0
 private void UpdateTrigger()
 {
     myBoxCollider2D.isTrigger = colorHandler.ColorContain(myMeshRenderer.material.color);
     if (!myBoxCollider2D.isTrigger)
     {
         gameObject.layer = LayerMask.NameToLayer("Platform");
     }
     else
     {
         gameObject.layer = LayerMask.NameToLayer("Gate");
     }
 }