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

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