protected override string GenerateCommandLineCommands() { List <string> argv = new List <string>(); argv.Add("/nologo"); argv.Add("/Fo"); argv.Add(Path.Combine(OutputDirectory.GetMetadata("FullPath"), Path.ChangeExtension(Path.GetFileName(ResourceScript.GetMetadata("FullPath")), "res"))); Log.LogWarning(ResourceScript.GetMetadata("SourceFilePath")); string sourceFileDirectory = Path.GetDirectoryName(ResourceScript.GetMetadata("SourceFilePath")); if (sourceFileDirectory.EndsWith("\\")) { sourceFileDirectory = sourceFileDirectory.Substring(0, sourceFileDirectory.Length - 1); } string[] includePaths = new[] { sourceFileDirectory, @"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um", $@"C:\Program Files (x86)\Windows Kits\10\include\10.0.{WindowsSDKBuildVersion}.0\ucrt", $@"C:\Program Files (x86)\Windows Kits\10\include\10.0.{WindowsSDKBuildVersion}.0\shared", $@"C:\Program Files (x86)\Windows Kits\10\include\10.0.{WindowsSDKBuildVersion}.0\um", $@"C:\Program Files (x86)\Windows Kits\10\include\10.0.{WindowsSDKBuildVersion}.0\winrt", $@"{VisualStudioInstallRoot}\VC\Tools\MSVC\{GetMSVCToolsVersion()}\ATLMFC\include", $@"{VisualStudioInstallRoot}\VC\Tools\MSVC\{GetMSVCToolsVersion()}\include" }; argv.AddRange(includePaths.Select(path => "/i" + path)); argv.Add(ResourceScript.GetMetadata("FullPath")); return(string.Join(" ", argv.Select(x => $"\"{x}\""))); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); int layermask = 1 << 13; if (Physics.Raycast(ray, out hit, Mathf.Infinity, layermask)) { //Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit.distance, Color.yellow); Debug.Log("Did Hit " + hit.transform.gameObject.tag); GameObject gameObject = hit.transform.gameObject; ResourceScript r = gameObject.GetComponent <ResourceScript>(); UnitScript u = gameObject.GetComponent <UnitScript>(); FloorScript f = gameObject.GetComponent <FloorScript>(); if (r != null) { //r.OnMouseDown2(); } if (u != null) { //u.OnMouseDown2(); } if (f != null) { //f.OnMouseDown2(); } } } }
// Use this for initialization void Start() { resourceGameObject = GameObject.FindWithTag ("Resource"); resourceScript = resourceGameObject.GetComponent<ResourceScript>(); _rigidbody3D = GetComponent<Rigidbody> (); }
// Use this for initialization private void Start() { TC = Instantiate(TileControlPreFab).GetComponent <TileController>(); rs = GetComponent <ResourceScript>(); TC.Setup(); TC.Cursor.GetComponent <ParticleSystem>().Stop(); Minimap.Setup(TC.NumTiles); EnemyParent = new GameObject(); waveText.text = currentWave.ToString(); Spawners = new SpawnerScript[StartPos.Length]; for (int i = 0; i < StartPos.Length; i++) { Spawners[i] = Instantiate(SpawnerPreFab, TC.TileToWorldPosition(StartPos[i]), transform.rotation).GetComponent <SpawnerScript>(); Spawners[i].Setup(StartPos[i]); Spawners[i].UpdatePath(); } if (AFK != null) { afkMode = true; TC.AllowPlayerMovement = false; StartWaveText.GetComponent <Text>().text = "Press G to Start the game!"; isFadingOut = true; oneSet = true; } }
// Use this for initialization void Start() { resourceGameObject = GameObject.FindWithTag("Resource"); resourceScript = resourceGameObject.GetComponent <ResourceScript>(); _rigidbody3D = GetComponent <Rigidbody> (); }
public void Split(ResourceScript rs, ItemContainer con) { ItemContainer a = ItemContainer.FindItemContainer(building.OutputContainers, rs.Item); if (a.item == ItemList.Nothing) { a.item = rs.Item; } ItemContainer.UpdateValue(1, a); }
private ResourceScript Root() { var rc = new ResourceScript(); while (Lexer.Peek() != Tokens.End) { var e = Element(); rc.Definition.Add(e); } PopExpected(Tokens.End); return(rc); }
// Simple function to reset all task tracking variables // Again, some parts may be redundant at times, but still easier than alternative private void ResetTaskVars() { m_ActiveSound = null; m_CurrentTask = Task.Idle; m_Timer = 0.0f; m_InPosition = m_TimerStarted = m_TaskCompleted = m_CantComplete = false; m_TaskGoal = m_TaskProgress = 0; m_ResourceType = Resource.None; m_CurrentResource = null; m_Stats.ResetMultipliers(); UpdateTaskText(); }
public void SpecialCase(ItemContainer con, ResourceScript rs) { //Special cases for certain buildings. if (building == BuildingList.Splitter && con.amount < con.item.MaxStack) { splitter.Split(rs, con); ItemContainer.UpdateValue(-1, con); } else if (gameObject.GetComponent <Crafting>() && con.amount < con.item.MaxStack) { crafting.Craft(); } }
void OnTriggerStay(Collider other) { if (other.GetComponent <ResourceScript> () && Input.GetMouseButtonDown(0)) { ResourceScript rs = other.GetComponent <ResourceScript>(); rs.Gather(50); playerInventory.AddItem(rs.resourceType, 50); } if (CheckForDroppedItems(other)) { return; } }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Resource")) { //Direct Pickup ResourceScript rs = other.GetComponent <ResourceScript>(); resources += rs.qty; rs.Die(); } else if (other.CompareTag("Queen")) { if (resources > 0) { other.gameObject.GetComponent <QueenController>().FeedResources(resources); resources = 0; } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.tag == "Resource") { ResourceScript resourceScript = collision.transform.GetComponent <ResourceScript>(); foreach (var resource in currentDiveResources) { if (resource.resourceId == resourceScript.resource.resourceId) { resource.amount += resourceScript.resource.amount; break; } } Destroy(collision.transform.gameObject); UpdateResourceCountOnScreen(); } }
// Start is called before the first frame update void Start() { DoorRenderer = objectToMove.GetComponent <Renderer>(); resourceCont = GameObject.FindObjectOfType <AMS_ResourceController>(); if (resourceCont == null) { Debug.Log("ERROR: can't find resource controller"); Debug.Log("Self Destructing!!!"); Destroy(gameObject); } /*else * { * actualTarget = resourceCont.winConditionResources * percOfCap; * if (percOfCap != 1f) * { * var component = GetComponentInChildren<LevelGateHelperScript>(); * if (component != null) { Destroy(component.gameObject); Debug.Log("Deleting mid gate trigger volume - see comments"); }//This is deleted because if you don't need the full resource amount to open it is probably not a level end * else { Debug.Log("can't find trigger, maybe someone already deleted it"); } * } * } */ var moveHSpeed = moveAmountHorizontal / timeOfMove; var moveVSpeed = moveAmountVertical / timeOfMove; moveSpeed = new Vector3(moveHSpeed, moveVSpeed, 0f); DoorAudioSource = gameObject.GetComponent <AudioSource>(); DoorAudioSource.playOnAwake = false; //Turn off playOnAwake DoorAudioSource.playOnAwake = false; // DoorAudioSource.outputAudioMixerGroup.audioMixer.name = "SfxMixer"; ResourceScript = GameObject.FindObjectOfType <ResourceScript>(); SetSpawnPoints(spawnPointsEnable, false);//this sets whatever the door would enable to disabled /* for (int i = 0; i < DoorSounds.Length; i++) * { * DoorSoundPicked++; * }*/ }
IEnumerator CheckInputs() { foreach (GameObject input in inupts) { hit = Physics.OverlapSphere(input.transform.position, inOverlapSphereRadius, onlyItems); //if it spots an object near it's input (The red thing on the back of buildings) if (hit.Length > 0) { ResourceScript rs = hit[0].GetComponent <ResourceScript>(); //Foreach foreach (ItemContainer con in InputContainers) { //If the item containers resource matches the one that's being fed in, increase the amount by one and destroy the game object. if (con.item.CurrentResourceType == rs.Item.CurrentResourceType && con.amount < con.item.MaxStack) { ItemContainer.UpdateValue(1, con); SpecialCase(con, rs); break; } //Otherwise use an empty one else if (con.item == NewItemList.Nothing) { con.item = rs.Item; ItemContainer.UpdateValue(1, con); SpecialCase(con, rs); break; } } Destroy(hit[0].gameObject); } } yield return(new WaitForFixedUpdate()); StartCoroutine(CheckInputs()); }
private void OnEnable() { _dt = 0; _resource = GetComponent <TargetScript>().GetTarget().GetComponent <ResourceScript>(); _storage = GetComponents <StorageScript>().Where(script => _resource.Type == script.Type).ToList()[0]; }
object SetApplicationIcon(TextBox tb) { string iconPath = tb.Text; string newIconId; ResourceScript rc; if (iconPath.Trim() == "") return null; if (iconResourceScriptPath != null) { rc = new ResourceScript(iconResourceScriptPath); newIconId = foundIconEntry != null ? foundIconEntry.ResourceID : DEFAULT_ICON_ID; rc.Save(iconResourceScriptPath); } else { iconResourceScriptPath = AddResourceScriptToProject(project, DEFAULT_RC_NAME); rc = new ResourceScript(); newIconId = DEFAULT_ICON_ID; } rc.SetIcon(newIconId, iconPath); rc.Save(iconResourceScriptPath); return null; }
/// <summary> /// Gets the icon file location from the rc files added to project. /// Searches all project items of type "ResourceCompile" and returns the resource of type ICON with the lowest ID. /// </summary> /// <returns>path to the icon file or null if the icon wasn't specified</returns> string GetApplicationIconPathFromResourceScripts() { foundIconEntry = null; iconResourceScriptPath = null; IEnumerable <ProjectItem> resourceScripts = project.Items.Where( item => item is FileProjectItem && ((FileProjectItem)item).BuildAction == "ResourceCompile"); // search in all resource scripts, but due to limitation in resource compiler, only one of them can contain icons foreach (ProjectItem item in resourceScripts) { ResourceScript rc = new ResourceScript(item.FileName); if (rc.Icons.Count == 0) continue; if (foundIconEntry == null || rc.Icons.First().ResourceID.CompareTo(foundIconEntry.ResourceID)<0) { foundIconEntry = rc.Icons.First(); iconResourceScriptPath = item.FileName; } } //when no icon was found, then select the resource script where icon definition may be created if (iconResourceScriptPath == null && resourceScripts.Any()) iconResourceScriptPath = resourceScripts.First().FileName; return foundIconEntry != null ? foundIconEntry.Data : null; }
void Start() { StartCoroutine(UpdateHighlights()); resource = new ResourceScript(Bomb, _modID, this); Audio.PlaySoundAtTransform("Selection", transform); StartCoroutine(resource.Name_Chooser(Player_joined)); resource.Top_letters = new List <char>(); resource.Bottom_letters = new List <char>(); resource.Right_letters = new List <char>(); resource.Left_letters = new List <char>(); for (int i = 0; i <= 7; i++) { if (i == 0 || i == 1) { GenerateLetter(1, i); } if (i == 2 || i == 3) { GenerateLetter(2, i); } if (i == 4 || i == 5) { GenerateLetter(3, i); } if (i == 6 || i == 7) { GenerateLetter(4, i); } } Moon_button.OnInteract += delegate() { if (!ismoonpressed && !isAnimating) { ismoonpressed = true; resource.Roles_Fight(); } return(false); }; foreach (KMSelectable button in Players) { button.OnInteract += delegate() { if (ismoonpressed) { Submission(button); } else { GetComponent <KMBombModule>().HandleStrike(); Debug.LogFormat("[Town of KTaNE #{0}] It clearly states in the manual that when you are READY you should CLICK on the MOON first!", _modID); } return(false); }; button.OnHighlight += delegate() { if (ismoonpressed) { Player_joined.text = resource.Players_name[Array.IndexOf(Players, button)]; } return; }; button.OnHighlightEnded += delegate() { if (ismoonpressed) { Player_joined.text = ""; } return; }; } foreach (KMSelectable arrow in RoleArrows) { arrow.OnInteract += delegate() { RoleArrowPress(arrow); return(false); }; } foreach (KMSelectable msg in MessageArrows) { msg.OnInteract += delegate() { MessageArrowPress(msg); return(false); }; } foreach (KMSelectable msgrole in MessageRoleArrows) { msgrole.OnInteract += delegate() { MessageRoleArrowPress(msgrole); return(false); }; } Submit.OnInteract += delegate() { SubmitBUTT(); return(false); }; Return.OnInteract += delegate() { ReturntoGame(); return(false); }; MessagesDisplay.OnInteract += delegate() { MessageDisplay(); return(false); }; MessageRoleDisplay.OnInteract += delegate() { MessagesRoleDisplay(); return(false); }; }
} // End of TakeWood() function private void GatherResource() { // Step 1) Path to current target node if (!MovementChecker()) // Check movement and pathing on desired node { return; // If false returned then not ready, so exit function } // Step 2) Check we have a resource if (m_CurrentResource == null) { m_CurrentResource = m_Resources[(int)m_ResourceType].GetTargetResource(); // If not, request a resource from the pointer if (m_CurrentResource == null) // Check if the resource returned is null { // If it is, then we have no resources available yet m_CantComplete = true; // So set can't complete flag return; // And exit function } // Otherwise, we've got a valid resource, so... m_TargetNodeString = m_CurrentResource.GetNodeName(); // Reset our target to suit new resource return; // Need to start pathing though so exit function for MovementChecker to run } // Step 3) Check if mesh has been setup for "animation" if (!m_InPosition) { // Otherwise we're at the right node, so... transform.LookAt(new Vector3(m_CurrentResource.transform.position.x, // Look at the resource position .x and .z transform.position.y, m_CurrentResource.transform.position.z)); // (keeping y though to avoid weird rotations) m_Mesh.SetMeshAlternate((int)m_CurrentTask, m_Alternate); // Set the mesh to alternate between default and chopping to resemble an animation m_ActiveSound = m_Audio.Play(m_TaskSoundName, m_CurrentResource.gameObject); m_InPosition = true; // Set InPosition flag to true switch (m_ResourceType) { case Resource.Log: m_Stats.SetHungerMultiplier(1.25f); break; case Resource.Berry: m_Stats.SetFatigueMultiplier(1.25f); break; case Resource.Fish: m_Stats.SetThirstMultiplier(1.25f); break; } // Don't need to return, as we can carry on to setting up timers and start task } // Step 4) Setup or Update task timer if (TimerChecker()) // Handle timer, returns true when timer finished { // Step 5) Handle resouce unit transfer bool resourceRemaining = m_CurrentResource.Gathered(); // Call get unit method on resource; bool to track if it's depleted, will use bool later on if (!m_Inventory.AddAmount(1, (int)m_ResourceType)) // Add one unit to inventory - use (int) cast on Resource enum (more readable than a const int) { // Something went wrong, either invalid parameters or inventory is full Debug.Log("ERROR: Couldn't add item '" + m_ResourceType.ToString() + "' to inventory in GatherResource()"); // Debug a warning m_CantComplete = true; // Just cancel task, this may be changed to have a better handler of full inventory etc m_Audio.Stop(m_ActiveSound); m_ActiveSound = null; return; // Quit the function } else // Otherwise add to inventory was successful... { m_TaskProgress += 1; // so increase task progress tracker } // Step 6) Check and handle task progress if (m_TaskProgress == m_TaskGoal) { // If task has now been completed m_TaskCompleted = true; // Bool flag to tell Update() we're done m_Audio.Stop(m_ActiveSound); m_ActiveSound = null; return; // Exit function } // Otherwise if the task isn't complete... // Step 7) Handle resource validity if (!resourceRemaining) // Check if resource is depleted (true = not depleted, false = depleted) { m_Audio.Stop(m_ActiveSound); m_ActiveSound = null; m_CurrentResource = m_Resources[(int)m_ResourceType].GetTargetResource(); // Try to get a new resource if (m_CurrentResource == null) // Check if resource is valid { m_CantComplete = true; // No more resources left, set can't complete to true return; // Exit function } m_Timer = m_TaskTimes[(int)m_CurrentTask]; // Otherwise resource is valid, so reset timer, m_TargetNodeString = m_CurrentResource.GetNodeName(); // Set the required node variable m_InPosition = false; // And set flag for NOT in position m_Mesh.ResetMesh(); // Return mesh to default m_Stats.ResetMultipliers(); // Set multiplier back to false till back to gathering return; // Exit function } // Otherwise, resource not depleted and task not finished so... m_Timer = m_TaskTimes[(int)m_CurrentTask]; // Reset timer return; // Exit function } }
private void OnDisable() { _storage = null; _resource = null; }
// Use this for initialization void Start() { EventManager.Reset += ResetThis; attachedResourceScript = gameObject.GetComponent <ResourceScript>(); initialWaitTime = attachedResourceScript.waitTimer; }