Esempio n. 1
0
        private void Start()
        {
            GetDistances();
            Timing.RunCoroutine(_UpdateGroundTilePositions());

            foreach (var tile in groundTileDistances)
            {
                onGroundTileChangedPosition.Raise(tile.Key.position);
            }
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            Vector3Event script = (Vector3Event)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.Vector3Field("Value ", value);

            if (GUILayout.Button("Raise"))
            {
                if (Application.isPlaying)
                {
                    script.Raise(value);
                }
            }
            GUILayout.EndVertical();
        }
Esempio n. 3
0
 protected override void OnEnterState()
 {
     onPlayPoof.Raise(transform.position);
     gameObject.SetActive(false);
     coroutine = Timing.RunCoroutine(WaitAtHomeThenFollowBall());
     carryingPieceScript.EnemyIsCarryingAPiece = false;
 }
Esempio n. 4
0
 void FixedUpdate()
 {
     if (!pSystem.IsAlive())
     {
         laserEvent.Raise(transform.localPosition);
         Destroy(this.gameObject);
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Raises the Onselect event
        /// </summary>
        public void OnSelected()
        {
            if (!CanBeSelected)
            {
                return;
            }

            //Sends current position to Vector3EventListeners
            vector3Event.Raise(this.transform.position);
        }
Esempio n. 6
0
 public void Dig()
 {
     // if (!CanDig) return;
     DigCircle();
     UpdateHitMeshCollider();
     if (_groundDugEvent != null)
     {
         _groundDugEvent.Raise(HitVertexPosition);
     }
 }
            public override void OnInspectorGUI()
            {
                base.OnInspectorGUI();
                _invokeValue = EditorGUILayout.Vector3Field("Invoke value", _invokeValue);
                var buttonStyle = new GUIStyle(GUI.skin.button);

                buttonStyle.fontSize = 32;
                if (GUILayout.Button("Raise", buttonStyle, _buttonHeight))
                {
                    _target.Raise(_invokeValue);
                }
            }
Esempio n. 8
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        GUI.enabled = Application.isPlaying;

        Vector3Event e = target as Vector3Event;

        if (GUILayout.Button("Raise"))
        {
            e.Raise(value);
        }
    }
Esempio n. 9
0
    //void SpawnLaserOLDER()
    //{
    //    Vector3 spawnPos = new Vector3(Random.Range(-spawnZone.x, spawnZone.x) + uiOffset, spawnZone.y, spawnZone.z);
    //    //Instantiate(LaserWarnPrefab, spawnPos, Quaternion.identity);
    //    Instantiate(LaserPrefab, spawnPos, Quaternion.identity);
    //    Invoke("SpawnLaserOLDER", 1f / spawnPerSec);
    //}

    //void SpawnWarningOLD()
    //{
    //    Vector3 spawnPos = new Vector3(Random.Range(-spawnZone.x, spawnZone.x) + uiOffset, spawnZone.y, spawnZone.z);
    //    Instantiate(LaserWarnPrefab, spawnPos, Quaternion.identity);
    //    Invoke("SpawnWarningOLD", 1f / spawnPerSec);
    //}

    //void SpawnWarning3()
    //{
    //    Vector3 spawnPos = new Vector3(Random.Range(-spawnZone.x, spawnZone.x) + uiOffset, player.transform.position.y + playerOffset, spawnZone.z);
    //    Instantiate(LaserWarnPrefab, spawnPos, Quaternion.identity);
    //    // minimum of 1.5 seconds for 0 distance
    //    // want about 10 seconds for distance 400
    //    Invoke("SpawnWarning3", (enemy.dist + 75) / 50);
    //}

    void SpawnWarning()
    {
        float   spread   = Mathf.Clamp(enemy.dist / accFalloff, minAccSpread, maxAccSpread);
        Vector3 spawnPos = new Vector3(
            player.transform.position.x + Random.Range(-spread, spread),
            0,
            10);

        warningEvent.Raise(spawnPos);
        //Instantiate(LaserWarnPrefab, spawnPos, Quaternion.identity);
        // minimum of 1.5 seconds for 0 distance
        // want about 10 seconds for distance 400
        Invoke("SpawnWarning", (enemy.dist + 50) / 75);
    }
Esempio n. 10
0
 public void ShootLaser(Vector3 position)
 {
     laserWarnEvent.Raise(position);
 }
Esempio n. 11
0
 public void Move(Vector3 _input)
 {
     rb.MovePosition(
         transform.position + _input.normalized * movementSpeed.value * Time.deltaTime);
     onPlayerMoveEvent.Raise(rb.position);
 }
Esempio n. 12
0
 // Raise a tp event in Start to center camera AFTER it has been instantiated
 private void Start()
 {
     onPlayerTeleportEvent.Raise(rb.position);
 }
Esempio n. 13
0
 private void Start()
 {
     SpawnNew(0);
     setPlayerPos.Raise(startPos.transform.position);
 }