// Use this for initialization void Start() { AtavismEventSystem.RegisterEvent("LOADING_SCENE_START", this); AtavismEventSystem.RegisterEvent("LOADING_SCENE_END", this); AtavismEventSystem.RegisterEvent("PLAYER_TELEPORTED", this); SceneManager.sceneLoaded += LevelWasLoaded; }
void Start() { if (instance != null) { return; } instance = this; int gridCount = gridSize * gridSize; for (int i = 0; i < gridCount; i++) { gridItems.Add(new CraftingComponent()); } // Listen for messages from the server NetworkAPI.RegisterExtensionMessageHandler("CraftingGridMsg", HandleCraftingGridResponse); NetworkAPI.RegisterExtensionMessageHandler("CraftingMsg", HandleCraftingMessage); NetworkAPI.RegisterExtensionMessageHandler("BlueprintMsg", HandleBlueprintMessage); NetworkAPI.RegisterExtensionMessageHandler("resource_drops", HandleResourceDropsMessage); NetworkAPI.RegisterExtensionMessageHandler("resource_state", HandleResourceStateMessage); NetworkAPI.RegisterExtensionMessageHandler("start_harvest_task", HandleStartHarvestTask); NetworkAPI.RegisterExtensionMessageHandler("harvest_task_interrupted", HandleInterruptHarvestTask); // Listen for inventory changes AtavismEventSystem.RegisterEvent("INVENTORY_UPDATE", this); }
// Use this for initialization void Start() { loginState = LoginState.Login; AtavismEventSystem.RegisterEvent("LOGIN_RESPONSE", this); AtavismEventSystem.RegisterEvent("REGISTER_RESPONSE", this); AtavismEventSystem.RegisterEvent("SETTINGS_LOADED", this); // Play music SoundSystem.LoadSoundSettings(); if (musicObject != null) { SoundSystem.PlayMusic(musicObject.GetComponent <AudioSource>()); } }
// bool snapped = false; // Use this for initialization void Start() { if (instance != null) { return; } instance = this; // Register for AtavismEventSystem.RegisterEvent("PLACE_CLAIM_OBJECT", this); AtavismEventSystem.RegisterEvent("CLAIM_OBJECT_CLICKED", this); AtavismEventSystem.RegisterEvent("START_BUILD_CLAIM_OBJECT", this); AtavismEventSystem.RegisterEvent("CLAIM_CHANGED", this); }
int mainActionBar = 0; // Which bar is currently sitting in the main Action Bar UI // Use this for initialization void Start() { if (instance != null) { return; } instance = this; NetworkAPI.RegisterExtensionMessageHandler("actions", HandleActionsUpdate); // Listen for the Abilities and Inventory updates as the action bar may need to be updated to match AtavismEventSystem.RegisterEvent("ABILITY_UPDATE", this); AtavismEventSystem.RegisterEvent("INVENTORY_UPDATE", this); }
// Use this for initialization void Start() { if (instance != null) { return; } instance = this; AtavismEventSystem.RegisterEvent("CLAIM_ADDED", this); AtavismEventSystem.RegisterEvent("CLAIMED_REMOVED", this); AtavismEventSystem.RegisterEvent("LOGGED_OUT", this); // Register for messages relating to the claim system NetworkAPI.RegisterExtensionMessageHandler("claim_data", ClaimIDMessage); NetworkAPI.RegisterExtensionMessageHandler("remove_claim_data", ClaimRemoveDataMessage); NetworkAPI.RegisterExtensionMessageHandler("claim_updated", ClaimUpdatedMessage); NetworkAPI.RegisterExtensionMessageHandler("remove_claim", RemoveClaimMessage); NetworkAPI.RegisterExtensionMessageHandler("claim_deleted", RemoveClaimMessage); NetworkAPI.RegisterExtensionMessageHandler("claim_made", ClaimMadeMessage); NetworkAPI.RegisterExtensionMessageHandler("claim_object", ClaimObjectMessage); NetworkAPI.RegisterExtensionMessageHandler("claim_object_bulk", ClaimObjectBulkMessage); NetworkAPI.RegisterExtensionMessageHandler("move_claim_object", MoveClaimObjectMessage); NetworkAPI.RegisterExtensionMessageHandler("update_claim_object_state", UpdateClaimObjectStateMessage); NetworkAPI.RegisterExtensionMessageHandler("claim_object_info", ClaimObjectInfoMessage); NetworkAPI.RegisterExtensionMessageHandler("remove_claim_object", RemoveClaimObjectMessage); NetworkAPI.RegisterExtensionMessageHandler("buildingResources", HandleBuildingResources); NetworkAPI.RegisterExtensionMessageHandler("start_build_object", HandleStartBuildObject); NetworkAPI.RegisterExtensionMessageHandler("start_build_task", HandleStartBuildTask); NetworkAPI.RegisterExtensionMessageHandler("build_task_interrupted", HandleInterruptBuildTask); // Load in items buildObjectTemplates = new Dictionary <int, AtavismBuildObjectTemplate>(); Object[] prefabs = Resources.LoadAll("Content/BuildObjects"); foreach (Object displayPrefab in prefabs) { GameObject go = (GameObject)displayPrefab; AtavismBuildObjectTemplate displayData = go.GetComponent <AtavismBuildObjectTemplate>(); if (!buildObjectTemplates.ContainsKey(displayData.id) && displayData.id > 0) { buildObjectTemplates.Add(displayData.id, displayData); } } }
// Use this for initialization void Start() { if (instance != null) { return; } instance = this; AtavismEventSystem.RegisterEvent("World_Error", this); StartCharacterSelection(); if (characterEntries.Count == 0) { StartCharacterCreation(); } if (characterCamera != null) { characterCamera.SetActive(true); } }
// bool upadteIsRunning = false; // Coroutine chTimer; // Use this for initialization void Start() { // node = GetComponent<AtavismNode>(); obj = new GameObject("obj"); obj.layer = LayerMask.NameToLayer(AtavismCursor.Instance.layerForTexts); obj.transform.SetParent(transform, false); objectText = new GameObject("ObjectText"); objectText.layer = LayerMask.NameToLayer(AtavismCursor.Instance.layerForTexts); objectText.transform.SetParent(obj.transform, false); obj.transform.localPosition = new Vector3(0f, height, 0f); objectText.transform.localPosition = textPosition; TextMeshPro textMeshPro = objectText.AddComponent <TextMeshPro>(); textMeshPro.alignment = TextAlignmentOptions.Midline; textMeshPro.margin = textMargin; textMeshPro.fontSize = 2; textMeshPro.color = textColour; TMP_FontAsset font1 = Resources.Load("Lato-BoldSDFNames", typeof(TMP_FontAsset)) as TMP_FontAsset; textMeshPro.font = font1; textMeshPro.outlineWidth = 0.2f; #if AT_I2LOC_PRESET if (!string.IsNullOrEmpty(I2.Loc.LocalizationManager.GetTranslation(textfield))) { objectText.GetComponent <TextMeshPro>().text = I2.Loc.LocalizationManager.GetTranslation(textfield); } #else textMeshPro.text = textfield; #endif AtavismEventSystem.RegisterEvent("UPDATE_LANGUAGE", this); if (!AtavismSettings.Instance.NameVisable) { textMeshPro.enabled = false; } StartCoroutine(UpdateTimer()); }
// Use this for initialization void Start() { // Need to tell the client that this is the new active input controller ClientAPI.InputControllerActivated(this); cameraTargetOffset = headHeightAbovePlayerOrigin * Vector3.up; //cameraOrientation = transform.rotation * Vector3.back; //cameraOrientation = Quaternion.AngleAxis (Mathf.Deg2Rad * 20.0f, Vector3.up); AtavismEventSystem.RegisterEvent("MOUSE_SENSITIVE", this); MouseVelocity = AtavismSettings.Instance.GetGeneralSettings().sensitivityMouse; MouseWheelVelocity = AtavismSettings.Instance.GetGeneralSettings().sensitivityWheelMouse; Camera camera = Camera.main; if (PlayerYaw >= 180) { CameraYaw = this.PlayerYaw - 180.0f; } else { CameraYaw = this.PlayerYaw + 180.0f; } Vector3 cameraDir = camera.transform.rotation * Vector3.forward; Vector3 cameraTarget = target.position + target.rotation * cameraTargetOffset; camera.transform.position = (cameraTarget + cameraDir * cameraDist); sdeTarget = gameObject.GetComponent <SDETargeting>(); if (sdeTarget == null) { sdeTarget = gameObject.AddComponent <SDETargeting>(); } if (sdeTarget != null) { sdeTarget.A3PI = this; sdeTarget.Initiate(); } }
// Use this for initialization void Start() { if (instance != null) { DestroyImmediate(instance); } instance = this; if (AtavismClient.Instance != null) { ClientAPI.WorldManager.RegisterObjectPropertyChangeHandler("arena_flag", ClickableObjectHandler); ClientAPI.WorldManager.RegisterObjectPropertyChangeHandler("Usable", ClickableObjectHandler); } AtavismEventSystem.RegisterEvent("INVENTORY_UPDATE", this); UnityEngine.Cursor.visible = false; //UiSystem.OverrideFrameDetection = true; if (itemPickupButton == ItemPickupButton.Left) { activateButton = 1; pickupButton = 0; } }
//int frameSkip = 10; //int frameCount = 0; // Use this for initialization void Start() { AtavismEventSystem.RegisterEvent("WORLD_TIME_UPDATE", this); UpdateObjectStatus(); }
// Use this for initialization void Start() { node = GetComponent <AtavismNode>(); mob = new GameObject("mob"); mob.layer = LayerMask.NameToLayer(AtavismCursor.Instance.layerForTexts); mob.transform.SetParent(transform, false); mobName = new GameObject("mobName"); mobName.layer = LayerMask.NameToLayer(AtavismCursor.Instance.layerForTexts); mobName.transform.SetParent(mob.transform, false); if (transform.gameObject.GetComponent <CharacterController>() != null) { height = transform.gameObject.GetComponent <CharacterController>().height > 2 * transform.gameObject.GetComponent <CharacterController>().radius ? transform.gameObject.GetComponent <CharacterController>().height : transform.gameObject.GetComponent <CharacterController>().radius * 2; } else { height = textheight; } mob.transform.localPosition = new Vector3(0f, height, 0f); mobName.transform.localPosition = AtavismSettings.Instance.MobNamePosition; TextMeshPro textMeshPro = mobName.AddComponent <TextMeshPro>(); textMeshPro.alignment = AtavismSettings.Instance.MobNameAlignment;// TextAlignmentOptions.Midline; textMeshPro.margin = AtavismSettings.Instance.MobNameMargin; textMeshPro.fontSize = AtavismSettings.Instance.MobNameFontSize; textMeshPro.color = AtavismSettings.Instance.MobNameDefaultColor; if (AtavismSettings.Instance.MobNameFont == null) { TMP_FontAsset font1 = Resources.Load("Lato-BoldSDFNames", typeof(TMP_FontAsset)) as TMP_FontAsset; mobName.GetComponent <TextMeshPro>().font = font1; } else { mobName.GetComponent <TextMeshPro>().font = AtavismSettings.Instance.MobNameFont; } mobName.GetComponent <TextMeshPro>().outlineWidth = AtavismSettings.Instance.MobNameOutlineWidth; mobQuest = new GameObject("mobQuest"); mobQuest.layer = LayerMask.NameToLayer(AtavismCursor.Instance.layerForTexts); mobQuest.transform.SetParent(mobName.transform, false); mobQuest.transform.localPosition = AtavismSettings.Instance.GetNpcInfoTextPosition; TextMeshPro textMeshProQuest = mobQuest.AddComponent <TextMeshPro>(); textMeshProQuest.alignment = TextAlignmentOptions.Midline; textMeshProQuest.fontSize = AtavismSettings.Instance.GetNpcInfoTextSize; textMeshProQuest.color = AtavismSettings.Instance.GetNpcInfoTextColor; textMeshProQuest.text = ""; textMeshProQuest.spriteAsset = AtavismSettings.Instance.GetSpriteAsset; node = GetComponent <AtavismNode>(); if (node != null) { node.RegisterObjectPropertyChangeHandler("title", LevelHandler); node.RegisterObjectPropertyChangeHandler("subTitle", LevelHandler); node.RegisterObjectPropertyChangeHandler("level", LevelHandler); node.RegisterObjectPropertyChangeHandler("reaction", TargetTypeHandler); node.RegisterObjectPropertyChangeHandler("aggressive", TargetTypeHandler); node.RegisterObjectPropertyChangeHandler("adminLevel", AdminLevelHandler); node.RegisterObjectPropertyChangeHandler("questavailable", QuestAvailableHandler); node.RegisterObjectPropertyChangeHandler("questinprogress", QuestInProgressHandler); node.RegisterObjectPropertyChangeHandler("questconcludable", QuestConcludableHandler); node.RegisterObjectPropertyChangeHandler("dialogue_available", DialogueAvailableHandler); node.RegisterObjectPropertyChangeHandler("itemstosell", ItemsToSellHandler); node.RegisterObjectPropertyChangeHandler("nameDisplay", NameDisplayHandler); node.RegisterObjectPropertyChangeHandler("guildName", GuildNameDisplayHandler); node.RegisterObjectPropertyChangeHandler("deadstate", HandleDeadState); node.RegisterObjectPropertyChangeHandler("bankteller", BankHandler); #if AT_I2LOC_PRESET if (GetComponent <AtavismNode>().PropertyExists("displayName")) { if (!string.IsNullOrEmpty(I2.Loc.LocalizationManager.GetTranslation("Mobs/" + GetComponent <AtavismNode>().GetProperty("displayName")))) { mName = I2.Loc.LocalizationManager.GetTranslation("Mobs/" + GetComponent <AtavismNode>().GetProperty("displayName")); } else { mName = (string)GetComponent <AtavismNode>().GetProperty("displayName"); } } else { if (!string.IsNullOrEmpty(I2.Loc.LocalizationManager.GetTranslation("Mobs/" + GetComponent <AtavismNode>().name))) { mName = I2.Loc.LocalizationManager.GetTranslation("Mobs/" + GetComponent <AtavismNode>().name); } else { mName = GetComponent <AtavismNode>().name; } } #else if (GetComponent <AtavismNode>().PropertyExists("displayName") && !string.IsNullOrEmpty((string)GetComponent <AtavismNode>().GetProperty("displayName"))) { mName = (string)GetComponent <AtavismNode>().GetProperty("displayName"); } else { mName = GetComponent <AtavismNode>().name; } #endif } AtavismEventSystem.RegisterEvent("UPDATE_LANGUAGE", this); UpdateNameDisplay(true); if (!AtavismSettings.Instance.NameVisable) { textMeshPro.enabled = false; textMeshProQuest.enabled = false; } StartCoroutine(UpdateTimer()); StartCoroutine(UpdateIcon()); }