public override void OnInspectorGUI()
        {
            FloatEvent script = (FloatEvent)target;

            //Event Description
            GUILayout.BeginVertical();
            EditorGUILayout.LabelField("Event Description", EditorStyles.centeredGreyMiniLabel);
            EditorStyles.textField.wordWrap = true;
            script.EventDescription         = EditorGUILayout.TextArea(script.EventDescription, GUILayout.MinHeight(100));
            GUILayout.EndVertical();

            //Test Event Button
            GUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Test Event", EditorStyles.centeredGreyMiniLabel);
            value = EditorGUILayout.FloatField("Value ", value);

            if (GUILayout.Button("Raise"))
            {
                if (Application.isPlaying)
                {
                    script.Raise(value);
                }
            }
            GUILayout.EndVertical();
        }
Exemple #2
0
    //Changes the volume of the music in the game
    public void SetSFXVolume(float newVolume)
    {
        //Set the audio manager volume
        changeSFXVolumeEvent.Raise(newVolume);

        //Save the sfx volume in PlayerPrefs
        PlayerPrefs.SetFloat("SFXVolume", newVolume);
    }
Exemple #3
0
    //Changes the volume of the music in the game
    public void SetMusicVolume(float newVolume)
    {
        //Set the audio manager volume
        changeMusicVolumeEvent.Raise(newVolume);

        //Save the music volume in PlayerPrefs
        PlayerPrefs.SetFloat("MusicVolume", newVolume);
    }
 //enemy autoattack
 void enemyAttack()
 {
     if ((Time.time > timeAbleToBasicAttack) && (!isEnemyDead()))
     {
         enemyAnimator.SetTrigger("attack");
         timeAbleToBasicAttack = Time.time + basicAttackCooldown();
         attacking.Raise(currentAttack);
     }
 }
Exemple #5
0
            public override void OnInspectorGUI()
            {
                base.OnInspectorGUI();
                _invokeValue = EditorGUILayout.FloatField("Invoke value A", _invokeValue);
                var buttonStyle = new GUIStyle(GUI.skin.button);

                buttonStyle.fontSize = 32;
                if (GUILayout.Button("Raise", buttonStyle, _buttonHeight))
                {
                    _target.Raise(_invokeValue);
                }
            }
Exemple #6
0
    // Start is called before the first frame update
    public override void Start()
    {
        base.Start();

        //Enable the healthbar
        enableHealthBarEvent.Raise();

        //Set the max value on the healthbar
        setMaxHealthEvent.Raise(maxHealth.Value);

        //Update the healthbar immediately
        updateHealthBarEvent.Raise(health);
    }
Exemple #7
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        GUI.enabled = Application.isPlaying;

        FloatEvent e = target as FloatEvent;

        if (GUILayout.Button("Raise"))
        {
            e.Raise(value);
        }
    }
Exemple #8
0
    public override void ReceiveDamage(int valDamageReceived)
    {
        coreData.valHp -= valDamageReceived;
        Health          = coreData.valHp;

        coreHealthChangedEvent.Raise(Health);

        if (!wasDestroyed && Health <= 0)
        {
            wasDestroyed = true;
            coreDestroyedEvent.Raise();
            Die();
        }
    }
Exemple #9
0
    public override void ReceiveDamage(int valDamageReceived)
    {
        towerData.valHp -= valDamageReceived;
        Health           = towerData.valHp;

        towerHealthChangedEvent.Raise(Health);
        towerBeingAttackedEvent.Raise(towerData);

        if (Health <= 0 && !wasDestroyed)
        {
            wasDestroyed = true;
            towerDestroyedEvent.Raise(towerData);
            Die();
        }
    }
Exemple #10
0
    // // // // // // // // // // // // // //
    //dog switching and such
    public void switchDogs(int whichDog)
    {
        if (!dead[whichDog])
        {
            Debug.Log("switching to: " + dogs[whichDog]);
            Debug.Log("hp sent is: " + currentHP[whichDog]);

            hpSending.Raise(currentHP[whichDog]);

            gettingDogStats.Raise(dogs[whichDog]);
            Debug.Log("dog switch events received");
            currentDog = whichDog;
            Debug.Log("current dog is: " + currentDog);
        }
    }
    private void Update()
    {
        cleanedFloors = GetAmountOfTilesOfType(RoomTile.CleanFloor);

        if ((cleanedFloors != totalFloors) || stopTime)
        {
            time += Time.deltaTime;
        }

        DisplayData();

        if (cleanedFloors == totalFloors)
        {
            onFinishedCleaningRoom.Raise();
        }
    }
Exemple #12
0
        // Update is called once per frame
        void Update()
        {
            _horizontalTilt = this.transform.rotation.eulerAngles.z;

            // IF joystick is facing right
            if (_horizontalTilt < _maxRightRot && _horizontalTilt > _minRightRot)
            {
                _horizontalTilt = Mathf.Abs(_horizontalTilt - 360);
                // Turn crane left
                _craneRight.Raise(_horizontalTilt);
            }
            // IF joystick is facing left
            else if (_horizontalTilt > _minLeftRot && _horizontalTilt < _maxLeftRot)
            {
                // Turn crane right
                _craneLeft.Raise(_horizontalTilt);
            }
        }
Exemple #13
0
        public override void OnInspectorGUI()
        {
            //Draw the defualt inspector options
            DrawDefaultInspector();

            FloatEvent script = (FloatEvent)target;

            hSliderValue = GUI.HorizontalSlider(new Rect(25, 25, 100, 30), hSliderValue, 0.0F, 10.0F);

            //Draw button
            if (GUILayout.Button("Raise Event"))
            {
                //If the application is playing - raise/trigger the event
                if (EditorApplication.isPlaying)
                {
                    script.Raise(hSliderValue);
                }
            }
        }
 // // // // // // // // //
 //battle functions
 void dogAttack()
 {
     //checks if you can attack
     if (Time.time > timeAbleToBasicAttack)
     {
         //sets next time you can attack
         timeAbleToBasicAttack = Time.time + basicAttackCooldown();
         //tells everyone you are attacking
         attacking.Raise(currentAttack);
         dogAnimator.SetTrigger("attack");
         Debug.Log("attack good");
         //each attack adds one to charge
         chargeCount++;
     }
     else
     {
         Debug.Log("ITS ON COOLDOWN  Time is " + Time.time + ", able to attack at " + timeAbleToBasicAttack);
     }
 }
Exemple #15
0
 void Start()
 {
     ticker                = new Ticker(tankSize);
     ticker.OnTick        += (float value) => OnTankUpdate?.Raise(value);
     ticker.OnZeroOrBelow += () => OnTankEmpty?.Raise();
 }
Exemple #16
0
 public void RiseOnChange()
 {
     onChange?.Raise(Value);
     m_CurrentValue = Value;
 }
Exemple #17
0
        protected override void Triggered(Component other)
        {
            base.Triggered(other);

            Event.Raise(Random.value * range, Key);
        }