public void Activate(int aBombID) { m_lifeTime = GConfigManager.GetFloatValue("BombPickupLifeTime"); m_pickupID = aBombID; m_isActive = true; GetComponent <Rigidbody>().AddForce(GetRandomDirection() * 22, ForceMode.Impulse); }
void Start() { m_targetingReticule = (GameObject)Instantiate((GameObject)Resources.Load("Prefabs/Game/" + "TargetReticule"), Vector3.zero, Quaternion.identity); m_bulletSpeed = GConfigManager.GetFloatValue("BulletSpeed"); if (m_bullet1Prefab == null) { m_bullet1Prefab = (GameObject)Resources.Load("Prefabs/Game/" + "Bullet01"); } if (m_bullet2Prefab == null) { m_bullet2Prefab = (GameObject)Resources.Load("Prefabs/Game/" + "Bullet02"); } if (m_bombPrefab1 == null) { m_bombPrefab1 = (GameObject)Resources.Load("Prefabs/Game/" + "Bomb01"); m_bombPrefab2 = (GameObject)Resources.Load("Prefabs/Game/" + "Bomb02"); } if (m_muzzleFlarePrefab == null) { m_muzzleFlarePrefab = (GameObject)Resources.Load("Prefabs/Game/" + "MuzzleFlare"); } if (m_bombDropPrefab == null) { m_bombDropPrefab = (GameObject)Resources.Load("Prefabs/Game/" + "BombDrop"); } m_targetingReticule.transform.Find("TargetSprite").GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); }
protected override void OnResumeStateImpl(bool wasPaused) { base.OnResumeStateImpl(wasPaused); BaseNetworkBehavior.MSG_ENCODED = GConfigManager.GetIntValue("MSGENCODING"); BaseNetworkBehavior.SEND_INTERVAL = GConfigManager.GetFloatValue("SEND_INTERVAL"); GCore.Wrapper.RTTService.RegisterRTTPresenceCallback(OnPresenceCallback); GPlayerMgr.Instance.UpdateActivity(GPlayerMgr.LOCATION_MAIN_MENU, GPlayerMgr.STATUS_IDLE, ""); OnRefreshFriendsList(); }
protected override void Start() { Cursor.visible = true; Cursor.lockState = CursorLockMode.None; m_friendsListItem = new List <FriendsListItem>(); GEventManager.StartListening(GFriendsManager.ON_FRIENDS_LIST_UPDATED, OnRefreshFriendsList); GEventManager.StartListening(GEventManager.ON_INVITED_FRIEND, OnInvitedFriend); GEventManager.StartListening(GEventManager.ON_REFUSED_INVITE_FRIEND, OnRefusedInviteFriend); GEventManager.StartListening(GEventManager.ON_RTT_ENABLED, OnEnableRTTSuccess); GEventManager.StartListening(GEventManager.ON_PLAYER_DATA_UPDATED, OnUpdateStats); m_statsPanelContentLeft = GameObject.Find("StatsPanel").transform.FindDeepChild("ContentLeft").gameObject; m_statsPanelContentRight = GameObject.Find("StatsPanel").transform.FindDeepChild("ContentRight").gameObject; m_joinFriendsPanel = GameObject.Find("JoinFriendsPanel"); m_statText = GameObject.Find("StatText"); m_statValue = GameObject.Find("StatValue"); ChatInputField.onEndEdit.AddListener(delegate { OnEndEditHelper(); }); BombersNetworkManager.Instance.ConnectRTT(); GameObject playerName = GameObject.Find("PlayerName"); m_inputField = playerName.GetComponent <InputField>(); m_inputField.characterLimit = MAX_CHARACTERS_NAME; m_inputField.text = GPlayerMgr.Instance.PlayerData.PlayerName; m_inputField.interactable = false; PlayerRankIcon.UpdateIcon(GPlayerMgr.Instance.PlayerData.PlayerRank); BrainCloudStats.Instance.ReadStatistics(); BaseNetworkBehavior.MSG_ENCODED = GConfigManager.GetIntValue("MSGENCODING"); BaseNetworkBehavior.SEND_INTERVAL = GConfigManager.GetFloatValue("SEND_INTERVAL"); _stateInfo = new StateInfo(STATE_NAME, this); base.Start(); // should we push the connect screen if (!GCore.Wrapper.Client.Initialized) { GStateManager.Instance.PushSubState(ConnectingSubState.STATE_NAME); } #if STEAMWORKS_ENABLED QuitButton.SetActive(true); StoreButtonTop.SetActive(false); StoreButtonBottom.SetActive(true); #else QuitButton.SetActive(false); StoreButtonTop.SetActive(true); StoreButtonBottom.SetActive(false); #endif #if UNITY_WEBGL LeftButtonGroup.SetActive(false); #endif GPlayerMgr.Instance.GetXpData(); }
IEnumerator FireMultiShot() { for (int i = 0; i < GConfigManager.GetIntValue("MultishotAmount"); i++) { if (m_playerPlane == null) { break; } m_lastShot = Time.time; m_bulletSpawnPoint = m_playerPlane.m_bulletSpawnPoint; m_bulletVelocity = m_bulletSpawnPoint.forward.normalized; m_bulletVelocity *= m_bulletSpeed; m_bulletVelocity += m_playerPlane.GetComponent <Rigidbody>().velocity; GetComponent <BombersPlayerController>().FireBulletCommand(new BulletInfo(m_bulletSpawnPoint.position, m_bulletSpawnPoint.forward.normalized, GetComponent <BombersPlayerController>().NetId, m_bulletVelocity).GetJson()); yield return(new WaitForSeconds(GConfigManager.GetFloatValue("MultishotBurstDelay"))); } }
#pragma warning restore 649 #region BaseState protected override void Start() { _stateInfo = new StateInfo(STATE_NAME, this); m_maxTimeAllowedInState = GConfigManager.GetFloatValue("JoiningGameTimeOutTime"); InvokeRepeating("updateTimer", 1.0f, 1.0f); BaseSubState findGameState = GStateManager.Instance.FindSubState(CreateGameSubState.STATE_NAME); if (findGameState != null) { findGameState.ExitSubState(); } if (GStateManager.Instance.CurrentStateId == MainMenuState.STATE_NAME && (GStateManager.Instance.CurrentSubStateId == ConfirmJoinLobbySubState.STATE_NAME || GStateManager.Instance.CurrentSubStateId == LobbySubState.STATE_NAME)) { m_closeButton.SetActive(false); } base.Start(); }
public void FireWeapon(bool aIsAccelerating) { float fireDelay = GConfigManager.GetFloatValue("FireRateDelay"); if (aIsAccelerating) { fireDelay = GConfigManager.GetFloatValue("FastModeFireRateDelay"); } if ((Time.time - m_lastShot) > GConfigManager.GetFloatValue("MultishotDelay")) { StartCoroutine("FireMultiShot"); } else if ((Time.time - m_lastShot) > fireDelay) { m_lastShot = Time.time; m_bulletSpawnPoint = m_playerPlane.m_bulletSpawnPoint; m_bulletVelocity = m_bulletSpawnPoint.forward.normalized; m_bulletVelocity *= m_bulletSpeed; m_bulletVelocity += m_playerPlane.GetComponent <Rigidbody>().velocity; GetComponent <BombersPlayerController>().FireBulletCommand(new BulletInfo(m_bulletSpawnPoint.position, m_bulletSpawnPoint.forward.normalized, GetComponent <BombersPlayerController>().NetId, m_bulletVelocity).GetJson()); } }
private void lazyLoadReferences() { if (m_gMan == null) { m_gMan = GameObject.Find("GameManager").GetComponent <GameManager>(); } if (WeaponController == null) { WeaponController = GetComponent <WeaponController>(); } BrainCloudStats bcStats = BrainCloudStats.Instance; m_turnSpeed = GConfigManager.GetFloatValue("TurnSpeed"); m_turnSpeedModifier = GConfigManager.GetFloatValue("TurnSpeedModifier"); m_acceleration = GConfigManager.GetFloatValue("PlaneAcceleration"); m_linearAcceleration = GConfigManager.GetFloatValue("LinearAcceleration"); m_linearDeceleration = GConfigManager.GetFloatValue("LinearDeceleration"); m_baseHealth = GConfigManager.GetIntValue("BasePlaneHealth"); m_maxSpeedMultiplier = GConfigManager.GetFloatValue("MaxSpeedMultiplier"); m_missionText = m_gMan.MissionText; }
public void Activate(string aPlayer) { m_lifeTime = GConfigManager.GetFloatValue("FlareLifeTime"); m_isActive = true; m_player = aPlayer; foreach (GameObject plane in GameObject.FindGameObjectsWithTag("PlayerController")) { { m_playerPlane = plane; break; } } { transform.GetChild(1).GetChild(0).GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); transform.GetChild(1).GetChild(0).GetChild(0).GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); transform.GetChild(2).GetComponent <TextMesh>().color = new Color(1, 1, 1, 0); } if (m_playerPlane == null) { Destroy(gameObject); } }
override protected void Start() { m_velocityMaxMagnitude = GConfigManager.GetFloatValue("MaxAcceleration"); _classType = BombersNetworkManager.PLANE_CONTROLLER; m_lastPositions = new PlaneVector[1]; m_planeDamage = new List <GameObject>() { null, null, null, null }; TextMesh textMesh = transform.FindDeepChild("NameTag").gameObject.GetComponent <TextMesh>(); PlayerController = BombersPlayerController.GetPlayer(PlayerId); // setup the member info if (PlayerController.MemberInfo == null) { PlayerController.MemberInfo = BombersNetworkManager.LobbyInfo.GetMemberWithProfileId(PlayerController.ProfileId); } textMesh.text = PlayerController.m_displayName; if (PlayerController.IsLocalPlayer) { textMesh.text = ""; } m_planeBank = transform.FindDeepChild("PlaneBank"); for (int i = 0; i < m_lastPositions.Length; i++) { m_lastPositions[i] = new PlaneVector(transform.position, transform.up); } string teamBomberPath = ""; bool bHasGoldWings = false; if (PlayerController.MemberInfo.ExtraData.ContainsKey(GBomberRTTConfigManager.JSON_GOLD_WINGS)) { bHasGoldWings = (bool)PlayerController.MemberInfo.ExtraData[GBomberRTTConfigManager.JSON_GOLD_WINGS]; } if (PlayerController.m_team == 1) { teamBomberPath = bHasGoldWings ? "Bomber01Golden" : "Bomber01"; gameObject.layer = 8; textMesh.color = Color.green; } else { teamBomberPath = bHasGoldWings ? "Bomber02Golden" : "Bomber02"; gameObject.layer = 9; textMesh.color = Color.red; } SmartsComponent = PlayerController.transform.FindDeepChild("smartsComponent").gameObject; SmartsComponent.SetActive(true); SmartsComponent.layer = PlayerController.m_team == 1 ? 21 : 22; // debug collisions Transform graphicPivot = transform.FindDeepChild("PlaneGraphic"); GameObject graphic = (GameObject)Instantiate((GameObject)Resources.Load("Prefabs/Game/" + teamBomberPath), graphicPivot.position, graphicPivot.rotation); graphic.transform.parent = graphicPivot; graphic.transform.localPosition = Vector3.zero; graphic.transform.localRotation = Quaternion.identity; m_bulletSpawnPoint = graphic.transform.FindDeepChild("BulletSpawn"); m_leftContrail = graphic.transform.FindDeepChild("LeftSmokeTrail").GetComponent <ParticleSystem>(); m_rightContrail = graphic.transform.FindDeepChild("RightSmokeTrail").GetComponent <ParticleSystem>(); m_gunCharge = transform.FindDeepChild("GunCharge").gameObject; m_gunCharge.GetComponent <Animator>().speed = 1 / GConfigManager.GetFloatValue("MultishotDelay"); if (!PlayerController.IsLocalPlayer) { m_gunCharge.transform.Find("ChargeReady").transform.GetComponent <AudioSource>().enabled = false; } transform.localPosition = Vector3.zero; m_rigidBody = GetComponent <Rigidbody>(); _syncTransformInformation = true; // no delay by default m_syncTransformationDelay = 0.0f; transform.position = PlayerController.transform.position; if (IsServer) { SendStart(_classType, PlayerId, _fileName, transform); } base.Start(); }
protected override void Start() { _classType = BombersNetworkManager.BULLET_CONTROLLER; m_lifeTime = GConfigManager.GetFloatValue("BulletLifeTime") + m_lifeTimeOffset; base.Start(); }