- Home /
Question by
Fetdressing · Jul 01, 2013 at 01:30 PM ·
time
Slow (spell) Enemy unit, problem with duration
Hey! I am working on a slow spell that basicly will slow my enemies when cast on them. I have had problems with it lasting forever, so I tried fixing it, but instead it's not working at all. Here is my script:
function speedReduction(reduceSpeed : float){ //retriew float from Projectile.js
lastCalledTime = Time.time + afterSlowTime;
moveSpeed = moveSpeed - reduceSpeed;
projectorSlow.gameObject.SetActive(true);
//so the movementspeed wont pass under 0
if(moveSpeed <= maxSlowAmount){
moveSpeed = maxSlowAmount;
}
}
//And then this code is supposed to take away the slow when no slow has be applied for a time
if(lastCalledTime < Time.time){
Debug.Log("Slow Stop");
moveSpeed = startMoveSpeed;
projectorSlow.gameObject.SetActive(false);
}
Comment
Your answer
Follow this Question
Related Questions
fuel compsumation 0 Answers
Force mode and delta timing 1 Answer
How can I match up some code and an animation keyframe 0 Answers
Instantiating object after some fixed time... 2 Answers
Frame dependant game. Using update vs fixed update. 3 Answers