My code is set up so that my lake does something upon being seen by the player.
However, I’ve attempted to use transforming to do this, due to the fact that animation is quite painful to do and sync up and trigger with a script.
My question is, how do I, using translation, smoothly translate my lake from Y(23.92), to Y(2.74), upon being looked at by the player?
using UnityEngine;
using System.Collections;
public class WaterManager : MonoBehaviour {
bool WaterIsHigh = true;
float waterTimer = 0.0f;
public float waterStopTime = 5.0f;
GameObject currentWater;
// Use this for initialization
void Start () {
waterTimer = 0.0f;
}
void WaterCheck (){
if(!WaterIsHigh){
//Where the transformation code goes!
}
}
// Update is called once per frame
void Update () {
if (WaterIsHigh){
waterTimer += Time.deltaTime;
}
if (waterTimer > waterStopTime){
waterTimer = 0.0f;
WaterIsHigh = false;
}
}
}
Here is my code so far.
Thank you for any help!