private void Start() { //neighbor detector neighborDetector = GetComponent <SphereCollider> (); neighborDetector.isTrigger = true; //motor motor = GetComponent <ThingMotor> (); motor.SetAccel(settings.acceleration); motor.rb.drag = settings.drag; motor.rb.mass = settings.mass; motor.FacingTarget(settings.alwaysFacingTarget); //Instantiating Particle Object explodePS = GetComponentInChildren <ParticleSystem> (); if (explodePS == null) { stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} doesn't have a particle system?!", MyName); ThingConsole.LogWarning(stringBuilder.ToString()); } //Sound audioSource = gameObject.GetComponent <AudioSource> (); audioSource.rolloffMode = AudioRolloffMode.Linear; audioSource.spatialBlend = 1f; audioSource.maxDistance = 50; TTTStart(); }
public void OnWaterExit() { InWater = false; CancelInvoke("RescueFromWater"); OnLeaveWater(); ThingConsole.Log(FormatString("<color=orange>{0}</color> left <color=blue>water</color>.", MyName)); }
protected void Mute() { stopTalking = true; stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} is being muted.", MyName); ThingConsole.LogWarning(stringBuilder.ToString()); }
protected void DeMute() { stopTalking = false; stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} can speak again", MyName); ThingConsole.Log(stringBuilder.ToString()); }
// Update is called once per frame void Update() { float hour = sky.Cycle.Hour; if (hour > 19f && hour < 19.2f && !sunsetReported) { print("------Sunset------"); if (OnSunset != null) { OnSunset(); } ThingConsole.LogWarning("Sunset"); sunsetReported = true; IsDay = false; IsNight = true; Invoke("ResetSunsetReportFlag", reportCoolDown); } if (hour > 7f && hour < 7.2f && !sunriseReported) { print("------Sunrise------"); if (OnSunrise != null) { OnSunrise(); } ThingConsole.LogWarning("Sunrise"); IsDay = true; IsNight = false; sunriseReported = true; Invoke("ResetSunriseReportFlag", reportCoolDown); } }
protected void Speak(string content) { if (myChatBubble == null) { return; } if (stopTalking) { return; } if (speakInCD) { return; } TTTEventsManager.main.SomeoneSpoke(gameObject); myChatBubble.Speak(content); speakInCD = true; spokeTimeStamp = Time.time; stringBuilder.Length = 0; stringBuilder.AppendFormat("<color=orange>{0}</color> is speaking {1}", MyName, content); ThingConsole.Log(stringBuilder.ToString()); }
protected void ResetPosition() { motor.rb.position = ThingManager.main.transform.position; stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} position was reset", MyName); ThingConsole.Log(stringBuilder.ToString()); }
private void RescueFromWater() { if (InWater) { ResetPosition(); ThingConsole.LogWarning(FormatString("{0} is rescued from water", MyName)); } }
protected void StopMoving() { stopWalkingAround = true; motor.Stop(); stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} stopped moving", MyName); ThingConsole.Log(stringBuilder.ToString()); }
protected void SetTarget(Vector3 target) { if (!stopWalkingAround) { motor.SetTarget(target); ThingConsole.Log(FormatString("<color=orange>{0}</color> gained a <color=red>new</color> target.", MyName)); } }
protected void ResetColor() { if (mMat == null) { return; } mMat.color = originalColor; ThingConsole.Log(FormatString("{0} reset its own color", MyName)); }
public void OnWaterExit() { InWater = false; OnLeaveWater(); stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} left water.", MyName); ThingConsole.Log(stringBuilder.ToString()); }
private void RescueFromWater() { if (InWater) { ResetPosition(); stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} is rescued from water", MyName); ThingConsole.LogWarning(stringBuilder.ToString()); } }
protected void ResetColor() { if (mMat == null) { return; } mMat.color = originalColor; stringBuilder.Length = 0; stringBuilder.AppendFormat("{0} reset its own color", MyName); ThingConsole.Log(stringBuilder.ToString()); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Thing")) { OnMeetingSomeone(other.gameObject); ThingConsole.Log(gameObject.name + " is meeting " + other.name); if (!neighborList.Contains(other.gameObject)) { neighborList.Add(other.gameObject); } } }
protected void Speak(string content, float stayLength) { if (!speakInCD || !stopTalking) { TTTEventsManager.main.SomeoneSpoke(gameObject); if (chatBalloon == null) { chatBalloon = gameObject.GetComponentInChildren <ChatBalloon> (); } chatBalloon.SetTextAndActive(content, stayLength); speakInCD = true; Invoke("UnlockSpeakCD", speakCDLength); } ThingConsole.Log(gameObject.name + "is speaking: " + content); }
private void Start() { //neighbor detector // neighborDetector = GetComponent<SphereCollider> (); // neighborDetector.isTrigger = true; //no longer use sphere collider as neighbor detector if (GetComponent <SphereCollider>()) { Destroy(GetComponent <SphereCollider>()); } //motor motor = GetComponent <ThingMotor>(); motor.SetAccel(settings.acceleration * 4); motor.rb.drag = settings.drag; motor.rb.mass = settings.mass; motor.FacingTarget(settings.alwaysFacingTarget); //Instantiating Particle Object explodePS = GetComponentInChildren <ParticleSystem>(); if (explodePS == null) { ThingConsole.LogWarning(FormatString("{0} doesn't have a particle system?!", MyName)); } //Sound audioSource = gameObject.GetComponent <AudioSource>(); audioSource.playOnAwake = false; audioSource.loop = false; audioSource.bypassListenerEffects = false; audioSource.spatialBlend = 1f; audioSource.maxDistance = 35; audioSource.dopplerLevel = 5; //material var renderers = gameObject.GetComponentsInChildren <MeshRenderer>(); foreach (var rend in renderers) { rend.material = ColorManager.instance.GetMaterial(1f, Random.Range(0f, 1f) > 0.6f ? true : false); } TTTStart(); speakCD.GoCooldown(); }
protected void Speak(string content) { if (myChatBubble == null) { return; } if (stopTalking) { return; } if (speakCD.inCD) { return; } TTTEventsManager.main.SomeoneSpoke(gameObject); myChatBubble.Speak(content); ThingConsole.Log(FormatString("<color=orange>{0}</color> is speaking <i>{1}</i>", MyName, content)); speakCD.GoCooldown(); }
protected void Spark(Color particleColor, int numberOfParticles) { if (explodePS == null) { explodePS = GetComponentInChildren <ParticleSystem>(); if (explodePS == null) { return; } } ParticleSystem.MainModule particleMain = explodePS.main; particleMain.startColor = particleColor; var newBurst = new ParticleSystem.Burst(0f, numberOfParticles); explodePS.emission.SetBurst(0, newBurst); explodePS.Play(); TTTEventsManager.main.SomeoneSparked(gameObject); ThingConsole.Log(FormatString("<color=orange>{0}</color> sparked", MyName)); }
// Update is called once per frame void Update() { float hour = sky.Cycle.Hour; if (hour > 19f && hour < 19.2f && !sunsetReported) { print("------Sunset------"); if (OnSunset != null) { OnSunset(); } ThingConsole.LogWarning("Sunset"); sunsetReported = true; IsDay = false; IsNight = true; Invoke("ResetSunsetReportFlag", reportCoolDown); } if (hour > 7f && hour < 7.2f && !sunriseReported) { print("------Sunrise------"); if (OnSunrise != null) { OnSunrise(); } ThingConsole.LogWarning("Sunrise"); IsDay = true; IsNight = false; sunriseReported = true; Invoke("ResetSunriseReportFlag", reportCoolDown); } stringBuilder.Length = 0; stringBuilder.AppendFormat("\n\n{0}", sky.Cycle.DateTime.TimeOfDay.ToString()); timeText.text = stringBuilder.ToString(); }
protected void StopMoving() { stopWalkingAround = true; motor.Stop(); ThingConsole.Log(FormatString("{0} stopped moving", MyName)); }
protected void ResetColor() { rend.material.color = originalColor; ThingConsole.Log(gameObject.name + "reset its color"); }
protected void ResetPosition() { motor.rb.position = ThingManager.main.transform.position; ThingConsole.Log(gameObject.name + " position was reset"); }
// Update is called once per frame void Update() { ThingConsole.Log(RandomString(30)); }
protected void StopMoving() { stopWalkingAround = true; motor.Stop(); ThingConsole.Log(gameObject.name + " stopped moving"); }
protected void DeMute() { stopTalking = false; ThingConsole.Log(FormatString("{0} can speak again", MyName)); }
protected void DeMute() { stopTalking = false; ThingConsole.LogWarning(gameObject.name + "can speak again."); }
public void OnWaterExit() { InWater = false; OnLeaveWater(); ThingConsole.Log(gameObject.name + " left water."); }
protected void Mute() { stopTalking = true; ThingConsole.LogWarning(FormatString("{0} is being muted.", MyName)); }
protected void Mute() { stopTalking = true; ThingConsole.LogWarning(gameObject.name + "is being muted"); }