Beispiel #1
0
 // Start is called before the first frame update
 void Awake()
 {
     mind         = GetComponent <CreatureMind>();
     goAi         = GetComponent <AIDestinationSetter>();
     wanderAI     = GetComponent <WanderingDestinationSetter>();
     ai           = GetComponent <RichAI>();
     maxSpeed     = ai.maxSpeed;
     nextDecision = Random.Range(0, brainTime);
     //testing!
     rb             = GetComponent <Rigidbody>();
     jumpTimeOffset = Random.Range(0, 9);
     text           = transform.GetChild(0).GetComponent <TextMesh>();
     text.text      = "";
     //test soundmaking
     sm      = GetComponent <SoundMaker>();
     ih      = gameObject.AddComponent <ItemHandler>();
     health  = gameObject.AddComponent <Health>();
     effects = new List <ParticleSystem>();
     chatLog = ChatLog.instance;
     foreach (Transform child in transform)
     {
         ParticleSystem s = child.GetComponent <ParticleSystem>();
         if (s)
         {
             effects.Add(s);
         }
     }
 }
Beispiel #2
0
 public Command(SoundMaker sp, Verb v = Verb.Default, Noun n = Noun.Default, string custom = "", Transform subject = null, string plain = "")
 {
     this.speaker = sp;
     this.verb    = v;
     this.noun    = n;
     this.subject = subject;
     this.custom  = custom;
     this.plain   = plain;
 }
    private void Start()
    {
        var systemSize = 2000; //PlayerPrefs.GetInt(InformationPanel.SYSTEM_SIZE_PREF, DEFAULT_SYSTEM_SIZE);
        var system     = GetComponent <ParticleSystem>();

        GravitySystem  = new GravitySystem(system, systemSize);
        _bursts        = new Burst[systemSize];
        _soundMaker    = GetComponent <SoundMaker>();
        _impulseSource = GetComponent <CinemachineImpulseSource>();
    }
Beispiel #4
0
    IEnumerator PlaySounds()
    {
        if (!soundMaker)
        {
            soundMaker = GameObject.FindObjectOfType <SoundMaker>();
        }
        soundMaker.MakeSound(progressionSounds[0]);
        yield return(new WaitForSeconds(progressionSounds[0].length));

        soundMaker.MakeSound(progressionSounds[1]);
    }
 public void PlaySound(AudioClip clip)
 {
     if (!maker)
     {
         maker = GameObject.FindObjectOfType <SoundMaker>();
         maker.MakeSound(clip);
     }
     else
     {
         maker.MakeSound(clip);
     }
 }
Beispiel #6
0
        public void DestroyObjects()
        {
            if (Window != null)
            {
                UnityEngine.Object.Destroy(Window);
            }
            if (SoundMaker != null)
            {
                SoundMaker.StopAllVoices();
            }
            if (UpdateHandler != null)
            {
                UpdateHandler.ClearAllObservers();
            }
            if (GameEventDispatchManager != null)
            {
                GameEventDispatchManager.Clear();
            }
            if (Interpreter != null)
            {
                Interpreter.RemoveAllResizeNotifiers();
            }
            var         props = typeof(SharedObjects).GetProperties();
            IDisposable tempDisp;

            foreach (var prop in props)
            {
                if (!prop.PropertyType.IsValueType && prop.GetSetMethod() != null)
                {
                    tempDisp = prop.GetValue(this, null) as IDisposable;
                    if (tempDisp != null)
                    {
                        tempDisp.Dispose();
                    }
                    prop.SetValue(this, null, null);
                }
            }
        }
 private void Awake()
 {
     sm = GetComponent <SoundMaker>();
 }
 private void Start()
 {
     i = this;
 }
 private void Start()
 {
     maker = GameObject.FindObjectOfType <SoundMaker>();
 }
Beispiel #10
0
 public override void Awake()
 {
     base.Awake();
     head       = transform.Find("HeadPart").GetComponent <SpriteRenderer>();
     soundMaker = GetComponent <SoundMaker>();
 }
Beispiel #11
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        //Checked for Death
        if (Health <= 0)
        {
            //DIE
            animator.SetBool("fall_backward", true);
            isDead = true;
            return;
        }


        RaycastHit hit;
        Ray        ray          = currentCam.ScreenPointToRay(Input.mousePosition);
        bool       hitSomething = Physics.Raycast(ray, out hit, 100.0f);

        if (Input.GetMouseButtonDown(throwButton))
        {
            if (hitSomething)
            {
                SoundMaker sm = hit.transform.gameObject.GetComponent <SoundMaker>();
                if (sm == null && CurrentDistractions > 0)
                {
                    var        prefab = GetNewSoundMakerPrefab();
                    GameObject obj    = GameObject.Instantiate(prefab, hit.point + (Vector3.up * dropHeight), UnityEngine.Random.rotation);
                    SoundMaker smc    = obj.GetComponent <SoundMaker>();
                    if (smc == null)
                    {
                        smc = obj.AddComponent <SoundMaker>();
                    }

                    //smc.AddListener(this);


                    CurrentDistractions--;
                }
                else
                {
                    //Debug.Log("Kick the box:" + (ray.direction.normalized * 100).ToString());
                    //hit.rigidbody.AddForceAtPosition(hit.transform.worldToLocalMatrix * ray.direction.normalized * flickPower, hit.point);
                    hit.rigidbody.AddForce(ray.direction.normalized * flickPower, ForceMode.Impulse);

                    SoundsListener.RegisterSoundEvent(new SoundEvent
                    {
                        eventTime  = Time.time,
                        isInternal = false,
                        source     = hit.point,
                        strength   = flickPower * hit.rigidbody.mass
                    });
                }
            }
        }

        if (hitSomething)
        {
            SoundMaker sm = hit.transform.gameObject.GetComponent <SoundMaker>();
            if (sm == null)
            {
                Cursor.SetCursor(DropCursor, new Vector2(63, 97), CursorMode.Auto);
            }
            else
            {
                Cursor.SetCursor(ThumpCursor, new Vector2(20, 30), CursorMode.Auto);
            }
        }
        else
        {
            Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
        }

        //animator.SetBool("walking", isWalking);
        //animator.SetBool("aggressive", aggressive);
    }
Beispiel #12
0
    public static void TakeMessage(string msg, SoundMaker talker, Transform subject = null)
    {
        //deal with simon
        if (talker.simonSayer)
        {
            if (Time.time > talker.timeWhenSimonDies)
            {
                talker.simonSayer       = false;
                talker.simonSayee.simon = false;
                talker.simonSayee       = null;
            }
            else
            {
                talker.timeWhenSimonDies = Time.time + talker.simonTimeCheck;
            }
        }
        //end
        Command cmd = new Command(talker);

        string[] message = msg.Split(' ');
        bool     hasVerb = false;
        bool     hasNoun = false;

        foreach (string word in message)
        {
            //this ain't a verb or a noun...
            if (word.Length == 3 || word.Length == 5 || talker.simonSayer)
            {
                cmd.custom = word;
                continue;
            }
            if (hasVerb && hasNoun)
            {
                break;
            }
            if (verbs.ContainsKey(word))//its a verb!!
            {
                hasVerb  = true;
                cmd.verb = verbs[word];
                continue;
            }
            if (nouns.ContainsKey(word))//its a noun!!
            {
                hasNoun  = true;
                cmd.noun = nouns[word];
                continue;
            }
        }
        if (subject)
        {
            cmd.subject = subject;
            Debug.Log("su");
        }
        cmd.plain = msg;
        if (hasVerb && hasNoun)//congrats you have a whole command!
        {
            talker.MakeSound(cmd);
        }
        else//uh oh not a whole command
        {
            /*if (hasVerb)
             * {
             *  talker.MakeSound(cmd);
             * }else if (talker.simonSayer)//you're playing simon says
             * {
             *  talker.MakeSound(cmd);
             * }*/
            talker.MakeSound(cmd);
        }
    }
Beispiel #13
0
 // Use this for initialization
 void Start()
 {
     soundMaker = GetComponent <SoundMaker>();
 }
Beispiel #14
0
 private void Start()
 {
     anim       = panel.GetComponent <Animator>();
     attempts   = 0;
     soundMaker = GameObject.FindObjectOfType <SoundMaker>();
 }