public deActivate ( int activator = -1 ) : void | ||
activator | int | |
return | void |
// public void playerTouch() { // //Debug.Log("platform"); // //element.GetComponent<Mesh>().material = // if (door) { // if (!locked) { // activate(); // } else { // //?? play locked sound?? // } // } // } // public void activate() { // active = !active; // if (delayedTime >= delay) { // extending = !extending; // extended = !extended; // delayedTime = 0; // hasActivated = true; // } // } // Update is called once per frame void Update() { // if (platformid == 436 || platformid == 443) { // ; // } bool transit = true; if (platform.active) { float speed = platform.speed * Time.deltaTime; if (delayedTime <= platform.delay) { delayedTime += Time.deltaTime; speed = 0; } // if (speed != 0 && platformid == 0) { // ; // } // Debug.Log("active"); // Debug.Log(platform.Speed); // Debug.Log(platform.extending); if (platform.extending) { if (fromTop) { if (gameObject.transform.localPosition.y > min.y) { gameObject.transform.localPosition -= new Vector3(0, speed, 0); } else { gameObject.transform.localPosition = min; transit = false; } } else { if (gameObject.transform.localPosition.y < max.y) { gameObject.transform.localPosition += new Vector3(0, speed, 0); } else { gameObject.transform.localPosition = max; transit = false; } } } else { if (platform.contractsSlower) { speed = speed * 0.66f; } if (fromTop) { if (gameObject.transform.localPosition.y < max.y) { gameObject.transform.localPosition += new Vector3(0, speed, 0); } else { gameObject.transform.localPosition = max; transit = false; } } else { if (gameObject.transform.localPosition.y > min.y) { gameObject.transform.localPosition -= new Vector3(0, speed, 0); } else { gameObject.transform.localPosition = min; transit = false; } } } // Debug.Log(transit); // Debug.Log(transit); if (!transit) { inTransit = false; // platform.active = false; // platform.extended = !platform.extended; // platform.extending = !platform.extending; platform.deActivate(); } } if (fromTop) { platform.upperBottom.setLight(); platform.upperTop.setLight(); foreach (MapSegmentSide side in platform.upperSides) { side.setLight(); } } else { platform.lowerBottom.setLight(); platform.lowerTop.setLight(); foreach (MapSegmentSide side in platform.lowerSides) { side.setLight(); } } }