#pragma warning disable 0414 protected override void Awake() { base.Awake(); if (!PhotonNetwork.connected) { Destroy(this); } //FirstUpdate = false; if (!this.isMine) { if (HeatTarget.gameObject.activeSelf == false) { HeatTarget.gameObject.SetActive(true); } } m_PositionControl = new PhotonTransformViewPositionControl(m_PositionModel); m_RotationControl = new PhotonTransformViewRotationControl(m_RotationModel); m_ScaleControl = new PhotonTransformViewScaleControl(m_ScaleModel); Controller = GetComponent <bl_FirstPersonController>(); Settings = GetComponent <bl_PlayerSettings>(); PDM = GetComponent <bl_PlayerDamageManager>(); DrawName = GetComponent <bl_DrawName>(); RoomMenu = FindObjectOfType <bl_RoomMenu>(); m_CController = GetComponent <CharacterController>(); FrienlyFire = (bool)PhotonNetwork.room.CustomProperties[PropertiesKeys.RoomFriendlyFire]; }
protected void OnPickup(Player m_actor, int m_view) { PhotonView view = PhotonView.Find(m_view); if (view != null) { bl_PlayerSettings logic = view.GetComponent <bl_PlayerSettings>(); if (CanBePickedUpBy(logic) == true) { OnPickup(logic); if (PhotonNetwork.LocalPlayer == m_actor) { bool t_send = false;//Prevent call two or more events if (!t_send) { t_send = true; Team oponentTeam; if ((string)PhotonNetwork.LocalPlayer.CustomProperties[PropertiesKeys.TeamKey] == Team.Delta.ToString()) { oponentTeam = Team.Recon; } else { oponentTeam = Team.Delta; } string obtainedText = string.Format(bl_GameTexts.ObtainedFlag, oponentTeam.ToString()); bl_EventHandler.KillEvent(PhotonNetwork.NickName, string.Empty, obtainedText, (string)PhotonNetwork.LocalPlayer.CustomProperties[PropertiesKeys.TeamKey], 777, 15); } } } } }
/// <summary> /// /// </summary> protected override void Awake() { if (!photonView.IsMine || bl_CameraViewSettings.Instance.gamePlayerView == MFPSGamePlayerView.FirstPersonOnly) { enabled = false; return; } else { base.Awake(); } if (!cacheReferences) { SwitchViewKey = bl_CameraViewSettings.Instance.SwitchViewKey; playerReferences = GetComponent <bl_PlayerReferences>(); playerSettings = playerReferences.playerSettings; playerNetwork = playerReferences.playerNetwork; playerCamera = playerSettings.PlayerCamera.transform; weaponCamera = playerReferences.weaponCamera; cameraParent = playerCamera.parent; cameraShaker = playerReferences.cameraShaker; cameraRay = playerReferences.cameraRay; defaultFPPosition = playerCamera.localPosition; defaultFPRotation = playerCamera.localEulerAngles; #if UNITY_POST_PROCESSING_STACK_V2 weaponCameraEffects = weaponCamera.GetComponent <PostProcessLayer>(); #endif cacheReferences = true; } SetDefaultView(); }
#pragma warning disable 0414 protected override void Awake() { base.Awake(); if (!PhotonNetwork.connected) { Destroy(this); } //FirstUpdate = false; if (!this.isMine) { if (HeatTarget.gameObject.activeSelf == false) { HeatTarget.gameObject.SetActive(true); } } m_PositionControl = new PhotonTransformViewPositionControl(m_PositionModel); m_RotationControl = new PhotonTransformViewRotationControl(m_RotationModel); m_ScaleControl = new PhotonTransformViewScaleControl(m_ScaleModel); Controller = this.GetComponent <bl_PlayerMovement>(); Settings = this.GetComponent <bl_PlayerSettings>(); PDM = this.GetComponent <bl_PlayerDamageManager>(); DrawName = this.GetComponent <bl_DrawName>(); }
void OnTriggerEnter(Collider collider) { if (collider.CompareTag(bl_PlayerSettings.LocalTag)) { bl_PlayerSettings logic = collider.gameObject.GetComponent <bl_PlayerSettings>(); if (CanBePickedUpBy(logic) == true) { PickupObject(logic); } } }
void OnCapture(Player m_actor) { m_CarryingPlayer = null; transform.position = m_HomePosition; //Only the player who captures the flag, updates the properties if (PhotonNetwork.LocalPlayer == m_actor) { bl_EventHandler.KillEvent(PhotonNetwork.NickName, "", bl_GameTexts.CaptureTheFlag, (string)PhotonNetwork.LocalPlayer.GetPlayerTeam().ToString(), 777, 15); IncreaseScore(); } }
public override void OnPickup(bl_PlayerSettings logic) { if (logic.m_Team == Team) { if (IsHome() == false) { ReturnFlag(); } } else { m_CarryingPlayer = logic; } }
public override bool CanBePickedUpBy(bl_PlayerSettings logic) { //If the flag is at its home position, only the enemy team can grab it if (IsHome() == true) { return(logic.m_Team != Team); } //If another player is already carrying the flag, no one else can grab it if (m_CarryingPlayer != null) { return(false); } return(true); }
#pragma warning disable 0414 protected override void Awake() { base.Awake(); if (!PhotonNetwork.connected) Destroy(this); //FirstUpdate = false; if (!this.isMine) { if (HeatTarget.gameObject.activeSelf == false) HeatTarget.gameObject.SetActive(true); } m_PositionControl = new PhotonTransformViewPositionControl(m_PositionModel); m_RotationControl = new PhotonTransformViewRotationControl(m_RotationModel); m_ScaleControl = new PhotonTransformViewScaleControl(m_ScaleModel); Controller = this.GetComponent<bl_PlayerMovement>(); Settings = this.GetComponent<bl_PlayerSettings>(); PDM = this.GetComponent<bl_PlayerDamageManager>(); DrawName = this.GetComponent<bl_DrawName>(); }
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>(); } }
void PickupObject(bl_PlayerSettings logic) { PhotonView.RPC("OnPickup", RpcTarget.AllBuffered, PhotonNetwork.LocalPlayer, logic.photonView.ViewID); }
void Start() { m_settings = this.transform.GetComponent <bl_PlayerSettings>(); m_PlayerTeam = m_settings.m_Team; isLocal = photonView.isMine; }
private static void Instegrate() { bl_MiniMapItem mmi = bl_MiniMapData.Instance.PlayerSetupTemplate; GameObject p1 = bl_GameData.Instance.Player1.gameObject; MiniMapDocumentation.CreateLayer("MiniMap"); int layerID = LayerMask.NameToLayer("MiniMap"); if (p1.GetComponent <bl_MiniMapItem>() == null) { bl_MiniMapItem mi = p1.AddComponent <bl_MiniMapItem>(); mi.Target = p1.transform; mi.Icon = mmi.Icon; mi.DeathIcon = mmi.DeathIcon; mi.IconColor = mmi.IconColor; mi.Size = mmi.Size; mi.OffScreenSize = mmi.OffScreenSize; mi.m_IconType = bl_MiniMapItem.IconType.Player; mi.isInteractable = false; mi.OffScreen = true; mi.DestroyWithObject = true; bl_PlayerSettings ps = p1.GetComponent <bl_PlayerSettings>(); int cm = ps.PlayerCamera.cullingMask; cm = cm & ~(1 << layerID); ps.PlayerCamera.cullingMask = cm; EditorUtility.SetDirty(p1); } p1 = bl_GameData.Instance.Player2.gameObject; if (p1.GetComponent <bl_MiniMapItem>() == null) { bl_MiniMapItem mi = p1.AddComponent <bl_MiniMapItem>(); mi.Target = p1.transform; mi.Icon = mmi.Icon; mi.DeathIcon = mmi.DeathIcon; mi.IconColor = mmi.IconColor; mi.Size = mmi.Size; mi.OffScreenSize = mmi.OffScreenSize; mi.m_IconType = bl_MiniMapItem.IconType.Player; mi.isInteractable = false; mi.OffScreen = true; mi.DestroyWithObject = true; bl_PlayerSettings ps = p1.GetComponent <bl_PlayerSettings>(); int cm = ps.PlayerCamera.cullingMask; cm = cm & ~(1 << layerID); ps.PlayerCamera.cullingMask = cm; EditorUtility.SetDirty(p1); } p1 = bl_GameData.Instance.BotTeam1.gameObject; if (p1.GetComponent <bl_MiniMapItem>() == null) { bl_MiniMapItem mi = p1.AddComponent <bl_MiniMapItem>(); mi.Target = p1.transform; mi.Icon = mmi.Icon; mi.DeathIcon = mmi.DeathIcon; mi.IconColor = mmi.IconColor; mi.Size = mmi.Size; mi.OffScreenSize = mmi.OffScreenSize; mi.m_IconType = bl_MiniMapItem.IconType.Bot; mi.isInteractable = false; mi.OffScreen = true; mi.DestroyWithObject = true; EditorUtility.SetDirty(p1); } p1 = bl_GameData.Instance.BotTeam2.gameObject; if (p1.GetComponent <bl_MiniMapItem>() == null) { bl_MiniMapItem mi = p1.AddComponent <bl_MiniMapItem>(); mi.Target = p1.transform; mi.Icon = mmi.Icon; mi.DeathIcon = mmi.DeathIcon; mi.IconColor = mmi.IconColor; mi.Size = mmi.Size; mi.OffScreenSize = mmi.OffScreenSize; mi.m_IconType = bl_MiniMapItem.IconType.Bot; mi.isInteractable = false; mi.OffScreen = true; mi.DestroyWithObject = true; EditorUtility.SetDirty(p1); } #if PSELECTOR foreach (var p in bl_PlayerSelector.Data.AllPlayers) { if (p.Prefab == null) { continue; } p1 = p.Prefab.gameObject; if (p1.GetComponent <bl_MiniMapItem>() != null) { continue; } bl_MiniMapItem mi = p1.AddComponent <bl_MiniMapItem>(); mi.Target = p1.transform; mi.Icon = mmi.Icon; mi.DeathIcon = mmi.DeathIcon; mi.IconColor = mmi.IconColor; mi.Size = mmi.Size; mi.OffScreenSize = mmi.OffScreenSize; mi.m_IconType = bl_MiniMapItem.IconType.Player; mi.isInteractable = false; mi.OffScreen = true; mi.DestroyWithObject = true; EditorUtility.SetDirty(p1); } #endif Debug.Log("Players setup for minimap correctly!"); }
void Start() { m_settings = this.transform.GetComponent<bl_PlayerSettings>(); m_PlayerTeam = m_settings.m_Team; isLocal = photonView.isMine; }
public abstract bool CanBePickedUpBy(bl_PlayerSettings logic);
public abstract void OnPickup(bl_PlayerSettings logic);
void OnDrop(Vector3 position) { m_CarryingPlayer = null; transform.position = position; m_ReturnTimer = ReturnTime; }