Example #1
0
    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();
    }
Example #2
0
 public void OnWaterExit()
 {
     InWater = false;
     CancelInvoke("RescueFromWater");
     OnLeaveWater();
     ThingConsole.Log(FormatString("<color=orange>{0}</color> left <color=blue>water</color>.", MyName));
 }
Example #3
0
 protected void Mute()
 {
     stopTalking          = true;
     stringBuilder.Length = 0;
     stringBuilder.AppendFormat("{0} is being muted.", MyName);
     ThingConsole.LogWarning(stringBuilder.ToString());
 }
Example #4
0
 protected void DeMute()
 {
     stopTalking          = false;
     stringBuilder.Length = 0;
     stringBuilder.AppendFormat("{0} can speak again", MyName);
     ThingConsole.Log(stringBuilder.ToString());
 }
Example #5
0
    // 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);
        }
    }
Example #6
0
    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());
    }
Example #7
0
 protected void ResetPosition()
 {
     motor.rb.position    = ThingManager.main.transform.position;
     stringBuilder.Length = 0;
     stringBuilder.AppendFormat("{0} position was reset", MyName);
     ThingConsole.Log(stringBuilder.ToString());
 }
Example #8
0
 private void RescueFromWater()
 {
     if (InWater)
     {
         ResetPosition();
         ThingConsole.LogWarning(FormatString("{0} is rescued from water", MyName));
     }
 }
Example #9
0
 protected void StopMoving()
 {
     stopWalkingAround = true;
     motor.Stop();
     stringBuilder.Length = 0;
     stringBuilder.AppendFormat("{0} stopped moving", MyName);
     ThingConsole.Log(stringBuilder.ToString());
 }
Example #10
0
 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));
     }
 }
Example #11
0
 protected void ResetColor()
 {
     if (mMat == null)
     {
         return;
     }
     mMat.color = originalColor;
     ThingConsole.Log(FormatString("{0} reset its own color", MyName));
 }
Example #12
0
    public void OnWaterExit()
    {
        InWater = false;
        OnLeaveWater();

        stringBuilder.Length = 0;
        stringBuilder.AppendFormat("{0} left water.", MyName);
        ThingConsole.Log(stringBuilder.ToString());
    }
Example #13
0
 private void RescueFromWater()
 {
     if (InWater)
     {
         ResetPosition();
         stringBuilder.Length = 0;
         stringBuilder.AppendFormat("{0} is rescued from water", MyName);
         ThingConsole.LogWarning(stringBuilder.ToString());
     }
 }
Example #14
0
 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());
 }
Example #15
0
 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);
         }
     }
 }
Example #16
0
 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);
 }
Example #17
0
    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();
    }
Example #18
0
    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();
    }
Example #19
0
    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));
    }
Example #20
0
    // 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();
    }
Example #21
0
 protected void StopMoving()
 {
     stopWalkingAround = true;
     motor.Stop();
     ThingConsole.Log(FormatString("{0} stopped moving", MyName));
 }
Example #22
0
 protected void ResetColor()
 {
     rend.material.color = originalColor;
     ThingConsole.Log(gameObject.name + "reset its color");
 }
Example #23
0
 protected void ResetPosition()
 {
     motor.rb.position = ThingManager.main.transform.position;
     ThingConsole.Log(gameObject.name + " position was reset");
 }
Example #24
0
 // Update is called once per frame
 void Update()
 {
     ThingConsole.Log(RandomString(30));
 }
Example #25
0
 protected void StopMoving()
 {
     stopWalkingAround = true;
     motor.Stop();
     ThingConsole.Log(gameObject.name + " stopped moving");
 }
Example #26
0
 protected void DeMute()
 {
     stopTalking = false;
     ThingConsole.Log(FormatString("{0} can speak again", MyName));
 }
Example #27
0
 protected void DeMute()
 {
     stopTalking = false;
     ThingConsole.LogWarning(gameObject.name + "can speak again.");
 }
Example #28
0
 public void OnWaterExit()
 {
     InWater = false;
     OnLeaveWater();
     ThingConsole.Log(gameObject.name + " left water.");
 }
Example #29
0
 protected void Mute()
 {
     stopTalking = true;
     ThingConsole.LogWarning(FormatString("{0} is being muted.", MyName));
 }
Example #30
0
 protected void Mute()
 {
     stopTalking = true;
     ThingConsole.LogWarning(gameObject.name + "is being muted");
 }