// 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; }
private void MakePlayerFaster() { if (player.forwardSpeed < maxPlayerSpeed) { player.forwardSpeed += speedIncreaseSteps; DelayCall.Call(this, MakePlayerFaster, 5); } }
private void Awake() { DelayCall.Call(this, MakePlayerFaster, 5); }