コード例 #1
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Debug.Log("Shoot");
         OnShootingBullets.Raise();
     }
     if (Input.GetMouseButtonDown(1))
     {
         Debug.Log("Throw");
         OnThrowingGrenades.Raise();
     }
     if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow))
     {
         Debug.Log("move forward");
         OnMoveForward.Raise();
     }
     else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
     {
         Debug.Log("move backward");
         OnMoveBackward.Raise();
     }
     else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
     {
         Debug.Log("move left");
         OnMoveLeft.Raise();
     }
     else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
     {
         Debug.Log("move right");
         OnMoveRight.Raise();
     }
 }
コード例 #2
0
 private void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.CompareTag(GameTags.EnemyTag))
     {
         OnPlayerDies.Raise();
         // Destroy(this.gameObject,0.5f);
         this.gameObject.SetActive(false);
     }
 }
コード例 #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            //base.OnInspectorGUI();

            EditorGUILayout.PropertyField(description);
            EditorGUILayout.PropertyField(Value);
            if (GUILayout.Button("Raise"))
            {
                script.Raise();
            }
            GuiLine(1);
            // EditorGUILayout.PropertyField(listeners);
            ShowList(listeners, script.listeners);
            serializedObject.ApplyModifiedProperties();
        }