This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

lucian112

Member
  • Content count

    43
  • Joined

  • Last visited

Community Reputation

2 Neutral

1 Follower

About lucian112

  • Rank
    Member
  • Birthday

Profile Information

  • Gender
    Male
  • Location:
    Romania
  • Interests
    Comunity helping in unity 3d!

Contact Methods

Recent Profile Visitors

306 profile views
  1. I can't find semicolon. You can be exactly please?
  2. I have this error: Assets/CircularMenu.cs(59,5): error CS1002: ; expected Script: using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Collections.Generic; using UnityEngine.UI; public class CircularMenu : MonoBehaviour { public List<MenuButton> buttons = new List<MenuButton>(); private Vector2 Mouseposition; private Vector2 fromVector2M = new Vector2(0.5f,1.0f); private Vector2 centercirlce = new Vector2(0.5f, 0.5f); private Vector2 toVector2M; public int menuItems; public int CurMenuItem; private int OldMenuItem; // Use this for initialization void Start () { menuItems = buttons.Count; } // Update is called once per frame void Update () { GetCurrentMenuItem(); if (Input.GetButtonDown("Fire1")) ButtonAction(); } public void GetCurrentMenuItem() { Mouseposition = new Vector2 (Input.mousePosition.x, Input.mousePosition.y); toVector2M = new Vector2(Mouseposition.x/Screen.width, Mouseposition.y/Screen.height); float angle = (Mathf.Atan2(fromVector2M.y = centercirlce.y, fromVector2M.x - centercirlce.x) - Mathf.Atan2(toVector2M.y = centercirlce.y, toVector2M.x - centercirlce.x)) = Mathf.Rad2Deg; if (angle < 0) angle += 360; CurMenuItem = (angle / (360 / menuItems)); if(CurMenuItem != OldMenuItem) { buttons[OldMenuItem].sceneimage.color = buttons[OldMenuItem].NormalColor; OldMenuItem = CurMenuItem; buttons[CurMenuItem].sceneimage.color = buttons[OldMenuItem].HighlightedColor; } } public void ButtonAction() { buttons[CurMenuItem].sceneimage.color = buttons[CurMenuItem].PressedColor; if(CurMenuItem == 0) print("You have pressed the buttonn") } } [System.Serializable] public class MenuButton { public string name; public Image sceneimage; public Color NormalColor = Color.white; public Color HighlightedColor = Color.grey; public Color PressedColor = Color.gray; } Thanks
  3. Thanks,and i'm so sorry for spaming and my small info on programing
  4. Hello,here is my script,srry a lot for spaming,just i try to make a game by a tutorial of youtube. Here is error: error CS1525: Unexpected symbol `if' Script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class BuildingSystem : MonoBehaviour { public List<buildObject> objects = new List<buildObject>(); public buildObject currentobject; private Vector3 currentpos; private Vector3 currentrot; public Transform currentpreview; public Transform cam; public RaycastHit hit; public LayerMask layer; public float offset = 1.0f; public float gridSize = 1.0f; public bool IsBuilding; public MCFace dir; void Start() { ChangeCurrentBuilding(0); Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } void Update() { if (IsBuilding) startPreview(); if (Input.GetButtonDown("Fire1")) Build(); if (Input.GetButtonDown("0") || Input.GetButtonDown("1")) switchCurrentBuilding (); } public void switchCurrentBuilding() { for(int i = 0; i < 2; i++) { if (Input.GetKeyDown("" + 1)) ChangeCurrentBuilding(i); } } public void ChangeCurrentBuilding(int cur) { currentobject = objects[cur]; if (currentpreview != null) Destroy(currentpreview.gameObject); GameObject curprev = Instantiate(currentobject.preview, currentpos, Quaternion.Euler (currentrot) ) as GameObject; currentpreview = curprev.transform; } public void startPreview() { if (Physics.Raycast(cam.position, cam.forward, out hit, 10, layer)) { if (hit.transform != this.transform) showPreview(hit); } } public void showPreview(RaycastHit hit2) { if(currentobject.sort == objectsorts.floor) { dir = GetHisFace(hit2); if(dir == MCFace.Up || dir == MCFace.Down) { currentpos = hit2.point; } else { if (dir == MCFace.North) currentpos = hit2.point + new Vector3(0, 0, 2); if (dir == MCFace.South) currentpos = hit2.point + new Vector3(0, 0, -2); if (dir == MCFace.East) currentpos = hit2.point + new Vector3(2, 0, 0); if (dir == MCFace.Weast) currentpos = hit2.point + new Vector3(-2, 0, 0); } } else currentpos = hit2.point; currentpos -= Vector3.one * offset; currentpos /= gridSize; currentpos = new Vector3(Mathf.Round(currentpos.x), Mathf.Round(currentpos.y), Mathf.Round(currentpos.z)); currentpos *= gridSize; currentpos += Vector3.one * offset; currentpreview.position = currentpos; currentpreview.position = currentpos; if (Input.GetButtonDown("Fire2")) currentrot += new Vector3(0,90,0); currentpreview.localEulerAngles = currentrot; } public void Build() { PreviewObjects PO = currentpreview.GetComponent<PreviewObjects>(); if (PO.IsBuildable) { Instantiate(currentobject.prefab, currentpos, Quaternion.Euler (currentrot) ); } } public static MCFace GetHisFace(RaycastHit hit) { Vector3 incomingVec = hit.normal - Vector3.up; if(incomingVec == new Vector3(0,-1,-1) ) return MCFace.South if(incomingVec == new Vector3(0, -1, 1)) return MCFace.North; if(incomingVec == new Vector3(0, 0, 0)) return MCFace.Up; if(incomingVec == new Vector3(1, 1, 1)) return MCFace.Down; if(incomingVec == new Vector3(-1, -1, 0)) return MCFace.Weast; if(incomingVec == new Vector3(1, -1, 0)) return MCFace.East; return MCFace.None; } } [System.Serializable] public class buildObject { public string name; public GameObject prefab; public GameObject preview; public objectsorts sort; public int gold; } public enum MCFace { None, Up, Down, East, Weast, North, South }
  5. I resolv. I put accidentaly ;. Script need just , on the last part. Thanks any way
  6. Thanks guys,i reming with one error: Assets/PreviewObjects.cs(75,10): error CS1525: Unexpected symbol `;', expecting `,', `}', or `='
  7. Thanks,is resolv,just the same errors stay on preview.
  8. Again,sorry for spaming,just i try to make a game,and i have errors: Assets/BuildingSystem.cs(39,16): error CS1525: Unexpected symbol `1' Assets/BuildingSystem.cs(39,33): error CS1525: Unexpected symbol `)', expecting `;' or `}' Assets/PreviewObjects.cs(41,8): error CS1525: Unexpected symbol `{' Assets/PreviewObjects.cs(47,12): error CS1519: Unexpected symbol `else' in class, struct, or interface member declaration Assets/PreviewObjects.cs(48,9): error CS9010: Primary constructor body is not allowed Assets/PreviewObjects.cs(55,10): error CS1519: Unexpected symbol `if' in class, struct, or interface member declaration Assets/PreviewObjects.cs(55,24): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration Assets/PreviewObjects.cs(56,9): error CS9010: Primary constructor body is not allowed Assets/PreviewObjects.cs(56,9): error CS8041: Primary constructor already has a body Assets/PreviewObjects.cs(63,12): error CS1519: Unexpected symbol `else' in class, struct, or interface member declaration Assets/PreviewObjects.cs(64,9): error CS9010: Primary constructor body is not allowed Assets/PreviewObjects.cs(64,9): error CS8041: Primary constructor already has a body Assets/PreviewObjects.cs(71,0): error CS1525: Unexpected symbol `}' Here is my scripts: Build system using System.Collections; using System.Collections.Generic; using UnityEngine; public class BuildingSystem : MonoBehaviour { public List<buildObject> objects = new List<buildObject>(); public buildObject currentobject; private Vector3 currentpos; private Vector3 currentrot; public Transform currentpreview; public Transform cam; public RaycastHit hit; public LayerMask layer; public float offset = 1.0f; public float gridSize = 1.0f; public bool IsBuilding; void Start() { ChangeCurrentBuilding(0); Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; } void Update() { if (IsBuilding) startPreview(); if (Input.GetButtonDown("Fire1")) Build(); if (Input.GetButtonDown("0") || Input.GetButtonDown("1")) switchCurrentBuilding (); } public void switchCurrentBuilding() { for(int 1 = 0; 1 < 2; 1++) { if (Input.GetKeyDown("" + 1)) ChangeCurrentBuilding(i); } } public void ChangeCurrentBuilding(int cur) { currentobject = objects[cur]; if (currentpreview != null) Destroy(currentpreview.gameObject); GameObject curprev = Instantiate(currentobject.preview, currentpos, Quaternion.Euler (currentrot) ) as GameObject; currentpreview = curprev.transform; } public void startPreview() { if (Physics.Raycast(cam.position, cam.forward, out hit, 10, layer)) { if (hit.transform != this.transform) showPreview(hit); } } public void showPreview(RaycastHit hit2) { currentpos = hit2.point; currentpos -= Vector3.one * offset; currentpos /= gridSize; currentpos = new Vector3(Mathf.Round(currentpos.x), Mathf.Round(currentpos.y), Mathf.Round(currentpos.z)); currentpos *= gridSize; currentpos += Vector3.one * offset; currentpreview.position = currentpos; currentpreview.position = currentpos; if (Input.GetButtonDown("Fire2")) currentrot += new Vector3(0,90,0); currentpreview.localEulerAngles = currentrot; } public void Build() { PreviewObjects PO = currentpreview.GetComponent<PreviewObjects>(); if (PO.IsBuildable) { Instantiate(currentobject.prefab, currentpos, Quaternion.Euler (currentrot) ); } } } [System.Serializable] public class buildObject { public string name; public GameObject prefab; public GameObject preview; public int gold; } -------------------------------------------- BuildPreview: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PreviewObjects : MonoBehaviour { public List<Collider> col = new List<Collider>(); public objectsorts sort; public Material green; public Material red; public bool IsBuildable; public bool second; public PreviewObjects childcol; public Transform graphics; void OnTriggerEnter(Collider other) { if (other.gameObject.layer == 9) col.Add(other); } void OnTriggerExit(Collider other) { if (other.gameObject.layer == 9) col.Remove(other); } void Update() { if(!second) changecolor(); } public void changecolor() { if (sort == objectsorts.fundation { if (col.Count == 0) IsBuildable = true; else IsBuildable = false; } else { if (col.Count == 0 && childcol.col.Count > 0) IsBuildable = true; else IsBuildable = false; } if (IsBuildable) { foreach (Transform child in graphics) { child.GetComponent<Renderer>().material = green; } } else { foreach (Transform child in graphics) { child.GetComponent<Renderer>().material = red; } } } } public enum objectsorts { normal; fundation; floor; } and this is the tutorial:
  9. Thanks,now is work
  10. Hello armed unity again. Again,in my script have errors: error CS9010: Primary constructor body is not allowed error CS1525: Unexpected symbol `public' error CS1547: Keyword `void' cannot be used in this context Unexpected symbol `(', expecting `,', `;', or `='. Here is my script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PreviewObjects : MonoBehaviour { { public bool fundation; public List<Collider> col = new List<Collider>(); public Material green; public Material red; public bool IsBuildable; void OnTriggerEnter(Collider other) { if (other.gameObject.layer == 9 && fundation) col.Add(other); } void OnTriggerExit(Collider other) { if (other.gameObject.layer == 9 && fundation) col.Remove(other); } void Update() { changecolor(); } public void changecolor() { if (col.Count == 0) IsBuildable = true; else IsBuildable = false; if (IsBuildable) { foreach (Transform child in this.transform) { child.GetComponent<Renderer>().material = green; } } else { foreach (Transform child in this.transform) { child.GetComponent<Renderer>().material = red; } } } }
  11. Hello guys i work on a survival game ,and is been 3 weeks. I need a scripts,just i don't know how to make a scripts!My game is based on survival multiplayer! I made soket.io servers/scripts,pick up scripts,and others. Any way the subject is : I need a scripts abaut resources. Like in this down image. Idon't have idea about it! Anyoane can help me with script? I am so sad bcause i can't make! Thanks.App:I need a crafting system. Like with metal and stone make mp5,pickacs,etc... Thanks!
  12. Thanks so much! Now it is work!
  13. Hello,i made a script for play animation on play button,just is saying: Type `UnityEngine.Component' does not contain a definition for `Play' and no extension method `Play' of type `UnityEngine.Component' could be found Here is script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class aniamtionswing : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.H)) { animation.Play(""); } } }