/// <summary> /// /// </summary> protected override void Awake() { base.Awake(); m_CharacterController = GetComponent <CharacterController>(); KillFeed = FindObjectOfType <bl_KillFeed>(); GameData = bl_GameData.Instance; Indicator = GetComponent <bl_DamageIndicator>(); PlayerSync = GetComponent <bl_PlayerSync>(); GunManager = transform.GetComponentInChildren <bl_GunManager>(true); HealthRegeneration = GameData.HealthRegeneration; }
private void OnEnable() { list = new ReorderableList(serializedObject, serializedObject.FindProperty(Dependency.GOListPropiertie), true, true, true, true); list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var element = list.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none); }; list.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "On No Ammo Desactive"); }; GameData = bl_GameData.Instance; }
void DrawCreateInfo() { if (subStep == 0) { DrawText("The first step to add a new weapon is create the weapon info,\n for it you need go to the 'GameData' and add a new field in\n the 'AllWeapons' list."); GUILayout.Space(10); if (DrawButton("Open GameData")) { bl_GameData gm = bl_GameData.Instance; Selection.activeObject = gm; EditorGUIUtility.PingObject(gm); subStep++; } } else if (subStep == 1) { DrawText("Now the GameData should be open in the inspector window,\n-There in the inspector of GameData in the bottom you will see a 'Weapon' section with a 'AllWeapons' list, open it and <b>Add</b> a new field to the list. \n<i>(use the button bellow)</i>"); if (DrawButton("Add Field Automatically")) { bl_GameData gm = bl_GameData.Instance; Selection.activeObject = gm; EditorGUIUtility.PingObject(gm); bl_GunInfo info = new bl_GunInfo(); info.Name = "New Weapon"; gm.AllWeapons.Add(info); subStep++; } } else if (subStep == 2) { DrawText("Now in the 'AllWeapons' list you should see a new field called <b>'New Weapon'</b>, open it and fill the information as required by the type of weapon you are adding."); DownArrow(); DrawPropertieInfo("Name", "string", "The name of this weapon, use a Unique name for each weapon so you can easily identified they."); DrawPropertieInfo("Type", "enum", "The type of this weapon, is a sniper, rifle, knife, etc..."); DrawPropertieInfo("Damage", "int", "The amount of damage that will cause this weapon with every hit."); DrawPropertieInfo("Fire Rate", "float", "Minimum time between shots."); DrawPropertieInfo("Reload Time", "float", "Time that take reload the weapon."); DrawPropertieInfo("Range", "int", "The maximum distance that the bullet of this weapon can travel (and hit something) before get destroyed."); DrawPropertieInfo("Accuracy", "int", "The spread of the bullet."); DrawPropertieInfo("Weight", "int", "The 'weight' of this weapon, the weight affect the player speed when this gun is enabled"); DrawPropertieInfo("Pick Up Prefab", "bl_GunPickUp", "The pick up prefab of this weapon, leave empty at the moment, you will set up later in this tutorial."); DrawPropertieInfo("Gun Icon", "Sprite", "an sprite icon that represent this weapon."); DownArrow(); DrawImage(GetServerImage(4)); GUILayout.Label("With this you have setup the weapon info, you're ready for the next step."); } }
void DrawPickUpPrefab() { if (subStep == 0) { DrawText("The last thing that you need set up is the 'PickUp prefab' of the weapon, this prefab is instance when pick up other weapon or when player die with the weapon active," + "so what you need is the weapon model, like for the TPWeapon you only need the weapon model mesh without hands and again is recommended use a low poly model for this one."); DownArrow(); DrawText("Drag your weapon model in hierarchy (don't need the player prefab for this one), select it and Add these Components:\n\n-<b>RigidBody</b>\n-<b>Sphere Collider</b>: in the sphere collider check" + " 'IsTrigger', this collider is the area where the gun will be detected, when player enter in this, so modify the position and radius if is necessary.\n-<b>Box Collider</b>: " + " with 'IsTrigger' unchecked, make the Bounds of this collider fit exactly with the weapon mesh.\n\nSo the inspector should be like this:"); DrawImage(GetServerImage(20)); DownArrow(); DrawText("and the Colliders Bounds should be like this: "); DownArrow(); DrawImage(GetServerImage(21)); } else if (subStep == 1) { DrawText("Now Add the script <b>bl_GunPickUp.cs</b> and set up the variables"); DownArrow(); DrawPropertieInfo("GunID", "enum", "Select the Weapon ID of this weapon, the one that you set up in GameData"); DrawPropertieInfo("Bullets", "int", "The bullets that contains this weapon when someone pickup"); DrawPropertieInfo("DestroyAfterTime", "bool", "Will the prefab get destroyed automatically after some time since was instantiated?"); DownArrow(); DrawText("Good, now create a prefab of this weapon, simple drag the object from hierarchy to a folder in the Project Window, just remember in which folder :)"); DownArrow(); DrawText("Finally, Go to GameData (click the button bellow)"); if (DrawButton("Open GameData")) { bl_GameData gm = bl_GameData.Instance; Selection.activeObject = gm; EditorGUIUtility.PingObject(gm); } DownArrow(); DrawText("in the inspector of GameData go to the 'AllWeapons' list and open the info of your weapon previously set up and in the field 'Pick Up Prefab' drag the weapon PickUp prefab (the one from Project folder" + " not from hierarchy):"); DrawImage(GetServerImage(22)); DownArrow(); DrawText("There you have!, You have finish to integrate the new weapon :), the first time could feel complicated but believe me is easier next time."); } }
/// <summary> /// /// </summary> protected override void Awake() { base.Awake(); if (!PhotonNetwork.connected || PhotonNetwork.room == null) { return; } RoomMenu = base.GetComponent <bl_RoomMenu>(); TimeManager = base.GetComponent <bl_RoundTime>(); UIReferences = bl_UIReferences.Instance; GameData = bl_GameData.Instance; #if BDGM BombDefuse = FindObjectOfType <bl_BombDefuse>(); #endif #if CP CoverPoint = FindObjectOfType <bl_CoverPointRoom>(); #endif ResetRoom(); GetRoomInfo(); }
private void OnEnable() { list = new ReorderableList(serializedObject, serializedObject.FindProperty(Dependency.GOListPropiertie), true, true, true, true); list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var element = list.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), element, GUIContent.none); }; list.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "On No Ammo Desactive"); }; GameData = bl_GameData.Instance; script = (bl_Gun)target; playerSettings = script.transform.root.GetComponent <bl_PlayerSettings>(); if (playerSettings != null) { AimReference = playerSettings.m_hands.AimPositionReference; } AimIcon = new GUIContent(EditorGUIUtility.IconContent("Main Light Gizmo").image); if (script != null) { GunManager = script.transform.parent.GetComponent <bl_GunManager>(); } }
/// <summary> /// /// </summary> void Awake() { GameData = bl_GameData.Instance; }