Exemple #1
0
        // Player Chararcter
        public void Refresh()
        {
            // deactivate collider
            int playerLayer   = LayerMask.NameToLayer("Player");
            int obstacleLayer = LayerMask.NameToLayer("Obstacle");

            ignoreCollision = true;
            Physics.IgnoreLayerCollision(playerLayer, obstacleLayer);
            Color c = material.GetColor("_Color");

            c.a = 0.1f;
            c.b = 0.5f;
            material.SetColor("_Color", c);
            c.a = 1;
            c.b = 0;


            float delayTime = 2 / forwardSpeed;

            // after one second set collider
            DelayCall.Call(this, () => {
                Debug.Log("Set collision active");
                ignoreCollision = false;
                Physics.IgnoreLayerCollision(playerLayer, obstacleLayer, false);
                material.SetColor("_Color", c);
            }, delayTime);

            outOfControl = false;
        }
Exemple #2
0
 private void MakePlayerFaster()
 {
     if (player.forwardSpeed < maxPlayerSpeed)
     {
         player.forwardSpeed += speedIncreaseSteps;
         DelayCall.Call(this, MakePlayerFaster, 5);
     }
 }
Exemple #3
0
 private void Awake()
 {
     DelayCall.Call(this, MakePlayerFaster, 5);
 }