Jump to content
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.

Search the Community

Showing results for tags 'need'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 14 results

  1. Unity car game using Unity 2018.2. I have decided to step away from the realistic fps genre and try something new. Racing!11!11!1! The game is something I would like to be a mix of Forza, Grid Autosport, and Need for Speed. In the game, you will have the choice to either participate in legal or illegal races. Legal races will have designated cars to be used in the race. Illegal races will let you use whatever car you want, unmodified or modified. Would also like to add death race mode and derby mode. My hopes would be to later add special car packs consisting of cars and planes from famous tv shows (Airwolf, Ghost Busters, Night Rider, Scooby Doo) and sell them as DLC. An example of my wishes would be something like the car packs for rocket league but also added modes (death race derby etc.). Anyways without further ado, here are screenies. https://imgur.com/a/BOs0zQT
  2. Hello friends I need serious programmer who has free time and wants to make money. I have game idea, arts, assets which have already liked by many people. all I want is good, sociable programmer who can build 2D co-op multiplayer shooter game. I'll give you 30% of the revenue from project. if yo're interested in and have questions about project please contact me on my email : giogedianidze@gmail.com I'll only reply on email Good luck to everyone
  3. Hello everyone! I am having a bit of trouble with this Inventory System. My game is going fine but the only problem is that playing it would be pointless because the Inventory doesn't even save! If anyone knows how to implement saving please help! and I know the script is big sorry . Thanks SCRIPT : using UnityEngine; using System.Collections; using System.Collections.Generic; public class Player : MonoBehaviour { public Transform myTransform; public Transform myBody; public Transform myHips; public Transform mySpine; public Transform myCamera; public Transform mySpawnpoint; public List<Transform> myItems; private Multiplayer multiplayer; private Transform[] myArray; private CharacterMotor myCharMotor; public Texture2D[] CrossHairs; public Inventory myInventory; public GameObject[] AttackPrefabs; private ItemDatabase db; public float nextUseTime; public float myHealth; public const float MAX_HEALTH = 100; public float healthRegen; public float prevHealth; public bool hitted = false; public bool bleeding = false; public const float MAX_STATS = 100; public float myHunger; public float hungerTake; public float myThirst; public float thirstTake; public float arrowForce = 600.0f; private Texture2D texture_background; private Texture2D texture_hotbar; private Texture2D texture_inventory; private Texture2D texture_crafting; private Texture2D image; private Texture2D recipes; public bool isInventoryOpen = false; public float screenSizeMultiplier = 0.6f; public InventoryItem selectedItem; public Vector2 selectedPos; private Vector2 btnSize; private Vector2 mousePos; public GUISkin skin; void Start() { //Load myObjects myArray = new Transform[5]; myItems = new List<Transform>(); myTransform = transform; myArray[0] = myTransform; myBody = myTransform.FindChild("body"); myArray[1] = myBody; myHips = myBody.FindChild("Hips"); myArray[2] = myHips; mySpine = myHips.FindChild("Spine").FindChild("Spine1").FindChild("Spine2"); myArray[3] = mySpine; myCamera = mySpine.FindChild("MainCamera"); myArray[4] = myCamera; mySpawnpoint = myCamera.FindChild("Spawnpoint"); myCharMotor = myTransform.GetComponent<CharacterMotor>(); /***********************************/ //Select all items Transform itemHolder = mySpine.FindChild("RightShoulder").FindChild("RightArm").FindChild("RightForeArm").FindChild("RightHand").FindChild("Items"); foreach(Transform c in itemHolder) { myItems.Add(c); } EnableDisableItems(-1, false); //Disable all items. //Set default health options myHealth = 100; healthRegen = 1.3f; prevHealth = 100; //Set default hunger and thirst myHunger = 100; myThirst = 100; thirstTake = 0.1f; hungerTake = 0.01f; //Load Crosshairs CrossHairs = new Texture2D[3]; CrossHairs[0] = (Texture2D)Resources.Load("Textures/Crosshairs/Crosshair1"); //Default crosshair //Load GUI Textures texture_background = (Texture2D)Resources.Load("Textures/HUD/background"); texture_hotbar = (Texture2D)Resources.Load("Textures/HUD/hotbar"); texture_inventory = (Texture2D)Resources.Load("Textures/HUD/inventory"); texture_crafting = (Texture2D)Resources.Load("Textures/HUD/crafting"); recipes = (Texture2D)Resources.Load("Textures/HUD/recipes"); //Setup new Inventory myInventory = new Inventory(); selectedItem = InventoryItem.NULL; //Get db db = GameObject.Find("MPManager").GetComponent<ItemDatabase>(); multiplayer = GameObject.Find("MPManager").GetComponent<Multiplayer>(); btnSize = new Vector2(70.5f, 70.5f); if(GetComponent<NetworkView>().isMine) { InvokeRepeating("ThirstAndHungerController", 0, 1); } InvokeRepeating("UpdateSoundSettings", 0, 3); } void Update() { HealthController(); EquipmentController(); if(GetComponent<NetworkView>().isMine) { EquipmentUse(); } AnimationController(); } void UpdateSoundSettings() { GetComponent<AudioSource>().volume = multiplayer.GetComponent<AudioSource>().volume; } void HealthController() { if (myHealth < MAX_HEALTH) { if(bleeding) { myHealth -= healthRegen * Time.deltaTime; } else { myHealth += healthRegen * Time.deltaTime; } } if(myHunger > 80 && myThirst > 80) { healthRegen = 2.2f; } if (myHealth > MAX_HEALTH) { myHealth = MAX_HEALTH; } if (myHealth < 1 && GetComponent<NetworkView>().isMine) { GameObject.Find("SpawnManager").GetComponent<SpawnManager>().isDead = true; Network.RemoveRPCs(Network.player); GetComponent<NetworkView>().RPC("DestroySelf", RPCMode.All); } if(hitted) { GetComponent<NetworkView>().RPC("UpdateMyCurrentHealthEverywhere", RPCMode.Others, myHealth); hitted = false; } if (myHealth > 0 && GetComponent<NetworkView>().isMine) { if (myHealth != prevHealth) { GetComponent<NetworkView>().RPC("UpdateMyHealthEverywhere", RPCMode.AllBuffered, myHealth); } } } void ThirstAndHungerController() { if(myHunger > 0) { myHunger -= hungerTake; } else { bleeding = true; } /* if(myThirst > 0) { myThirst -= thirstTake; } else { bleeding = true; } * */ if(myThirst > 0 && myHunger > 0) { bleeding = false; } } void ReloadAmmo() { InventoryItem item = myInventory.getItemByPosition(myInventory.curItem); if(item.item.getType().Equals("Gun")) { int ammoLeft = 20 - item.status[2]; if(item.status[3] > ammoLeft) { item.status[2] += ammoLeft; item.status[3] -= ammoLeft; } else { item.status[2] += item.status[3]; item.status[3] = 0; } } } public void KickBack() { transform.position = Vector3.Lerp(transform.position, transform.position - (transform.forward - transform.up), 1); } void EquipmentUse() { if( Screen.lockCursor ) { if (Input.GetButton("Fire1") && Time.time > nextUseTime) { InventoryItem item = myInventory.getItemByPosition(myInventory.curItem); if(item.item.getType().Equals("Gun")) { //Check ammo if(item.status[2] < 1) { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "ReloadGun", true, 1f); Invoke("ReloadAmmo", 1f); return; } else { item.status[2]--; } } else if(item.item.getType().Equals("Consumable")) { if(item.item.getDescription().Contains("(Food)")) { if(myHunger < MAX_STATS) myHunger += item.item.getDamage(); } else if (item.item.getDescription().Contains("(Drink)")) { if (myHunger < MAX_STATS) myThirst += item.item.getDamage(); } myInventory.myItems[(int)myInventory.curItem.x, (int)myInventory.curItem.y] = InventoryItem.NULL; myInventory.RemoveFromHotbar(item); selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } else if (item.item.getType().Equals("Placeable")) { //myInventory.myItems[(int)myInventory.curItem.x, (int)myInventory.curItem.y] = InventoryItem.NULL; //myInventory.RemoveFromHotbar(item); //selectedItem = InventoryItem.NULL; //selectedPos = new Vector2(29, 11); } else if (item.item.getType().Equals("Bow")) { //Check ammo if (item.status[2] < 1) { Invoke("ReloadAmmo", 1f); return; } else { item.status[2]--; } } nextUseTime = Time.time + item.item.getUseDelay(); string animName = item.item.getUseAnimation(); GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, animName.Trim(), true, item.item.getAnimationSpeed()); GetComponent<NetworkView>().RPC( "SpawnAttack", RPCMode.All, mySpawnpoint.position, Quaternion.Euler(mySpawnpoint.eulerAngles.x + 90, mySpawnpoint.eulerAngles.y, 0), transform.name, item.item.ID); } if(Input.GetButtonDown("Reload")) { InventoryItem item = myInventory.getItemByPosition(myInventory.curItem); if (item.item.getType().Equals("Gun")) { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "ReloadGun", true, 1f); Invoke("ReloadAmmo", 1f); } } if (Input.GetButton("Fire2")) { myCamera.GetComponent<Camera>().fieldOfView = Mathf.Lerp(myCamera.GetComponent<Camera>().fieldOfView, 40f, 2f * Time.deltaTime); } else { myCamera.GetComponent<Camera>().fieldOfView = Mathf.Lerp(myCamera.GetComponent<Camera>().fieldOfView, 60f, 2f * Time.deltaTime); } } } public void DeletePlaceable() { InventoryItem item = myInventory.getItemByPosition(myInventory.curItem); myInventory.myItems[(int)myInventory.curItem.x, (int)myInventory.curItem.y] = InventoryItem.NULL; myInventory.RemoveFromHotbar(item); selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } void EquipmentController() { InventoryItem curItem = myInventory.getItemByPosition(myInventory.curItem); int goID; if(curItem.Equals(InventoryItem.NULL)) { goID = 0; } else { goID = myInventory.getItemByPosition(myInventory.curItem).item.ID; } if (myItems[goID] != null) { EnableDisableItems(-1, false); EnableDisableItems(goID, true); } else { EnableDisableItems(-1, false); myInventory.curItem = new Vector2(0,0); } if(GetComponent<NetworkView>().isMine) { if (Input.GetMouseButtonDown(1) && !selectedItem.Equals(InventoryItem.NULL)) { selectedItem = InventoryItem.NULL; } if (Input.GetKeyDown(KeyCode.Alpha1)) { myInventory.curItem = myInventory.myHotbar[0]; GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "SwitchItem", true, 1.0f); } if (Input.GetKeyDown(KeyCode.Alpha2)) { myInventory.curItem = myInventory.myHotbar[1]; GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "SwitchItem", true, 1.0f); } if (Input.GetKeyDown(KeyCode.Alpha3)) { myInventory.curItem = myInventory.myHotbar[2]; GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "SwitchItem", true, 1.0f); } if (Input.GetKeyDown(KeyCode.Alpha4)) { myInventory.curItem = myInventory.myHotbar[3]; GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "SwitchItem", true, 1.0f); } if (Input.GetKeyDown(KeyCode.Alpha5)) { myInventory.curItem = myInventory.myHotbar[4]; GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "SwitchItem", true, 1.0f); } if(Input.GetButtonDown("Friendly")) { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "Friendly", true, 1.0f); } if(Input.GetButtonDown("Inventory")) { isInventoryOpen = !isInventoryOpen; multiplayer.EnableDisablePlayer(!isInventoryOpen); if (isInventoryOpen) multiplayer.gameState = Multiplayer.GameState.INVENTORY; else multiplayer.gameState = Multiplayer.GameState.PLAYING; } GetComponent<NetworkView>().RPC("SendCurrentItem", RPCMode.Others, (int)myInventory.curItem.x, (int)myInventory.curItem.y); } } void EnableDisableItems(int index, bool enable) { if(index == -1) { for (int i = 0; i < myItems.Count; i++) { myItems[i].gameObject.SetActive(enable); } } else { myItems[index].gameObject.SetActive(enable); } } int GetItemIndex(string GameObjectName) { for (int i = 0; i < myItems.Count; i++) { if (myItems[i].gameObject.name.Equals(GameObjectName)) return i; } return -1; } void OnGUI() { if(GetComponent<NetworkView>().isMine) { mousePos = new Vector2 (Input.mousePosition.x, -Input.mousePosition.y + Screen.height); GUI.skin = skin; if(multiplayer.gameState.Equals(Multiplayer.GameState.PLAYING) || multiplayer.gameState.Equals(Multiplayer.GameState.INVENTORY)) { //Draw Crosshair GUI.DrawTexture(new Rect(Screen.width / 2 - CrossHairs[0].width / 2, Screen.height / 2 - CrossHairs[0].height / 2, CrossHairs[0].width, CrossHairs[0].height), CrossHairs[0]); //Draw Hotbar and Inventory GUIController(); } if (Input.GetButton("Recipes")) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), recipes, ScaleMode.StretchToFill); } } } void GUIController() { if(isInventoryOpen) { //Draw Background GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture_background, ScaleMode.StretchToFill); //Draw Crafting float craft_w = texture_crafting.width * screenSizeMultiplier; float craft_h = texture_crafting.height * screenSizeMultiplier; Rect craftRect = new Rect(Screen.width / 2 - craft_w / 2, 0, craft_w, craft_h); GUI.DrawTexture(craftRect, texture_crafting); int btnsToShow = 1; for (int i = 0; i < myInventory.craftList.Count; i++) { if(!myInventory.craftList[i].Equals(InventoryItem.NULL)) { btnsToShow++; } } if(GUI.Button(new Rect(Screen.width - 100, 10, 100, 50), "Clear")) { myInventory.ClearCraftList(); } if (btnsToShow > 4) { btnsToShow = 4; } if(btnsToShow > 1) { //Lets see the recipe so far InventoryItem itemToCraft = db.getItemForRecipe(myInventory.craftList); if(!itemToCraft.Equals(InventoryItem.NULL)) { Vector2 startPos = new Vector2(craftRect.x + 12f * screenSizeMultiplier, craftRect.y + 60f * screenSizeMultiplier); Vector2 btnPos = startPos + new Vector2(btnSize.x * screenSizeMultiplier * 5 + (12f * screenSizeMultiplier * 5), 0); Texture2D image = (Texture2D)Resources.Load("Textures/Items/" + itemToCraft.item.ID); if (GUI.Button(new Rect(btnPos.x, btnPos.y, (btnSize.x) * screenSizeMultiplier, (btnSize.y - 10f) * screenSizeMultiplier), image)) { RemoveItemNetwork(db.getRecipeToRemove(itemToCraft, myInventory.craftList)); //Take the used resources myInventory.ClearCraftList(); //Clear craft list if(AddItemNetwork(itemToCraft)) { Debug.Log("Added Item"); } itemToCraft = InventoryItem.NULL; } } } for (int i = 0; i < btnsToShow; i++) { Vector2 startPos = new Vector2(craftRect.x + 12f * screenSizeMultiplier, craftRect.y + 60f * screenSizeMultiplier); Vector2 btnPos = startPos + new Vector2(btnSize.x * screenSizeMultiplier * i + (12f * screenSizeMultiplier * i), 0); if(myInventory.craftList[i].Equals(InventoryItem.NULL)) { if (GUI.Button(new Rect(btnPos.x, btnPos.y, (btnSize.x) * screenSizeMultiplier, (btnSize.y - 10f) * screenSizeMultiplier), "")) { if (!selectedItem.Equals(InventoryItem.NULL)) { myInventory.craftList[i] = selectedItem ; selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } } } else { Texture2D image = (Texture2D)Resources.Load("Textures/Items/" + myInventory.craftList[i].item.ID); GUI.DrawTexture(new Rect(btnPos.x, btnPos.y, (btnSize.x) * screenSizeMultiplier, (btnSize.y - 10f) * screenSizeMultiplier), image); } } //Draw Inventory float inv_w = texture_inventory.width * screenSizeMultiplier; float inv_h = texture_inventory.height * screenSizeMultiplier; Rect windowRect = new Rect(Screen.width / 2 - inv_w / 2, Screen.height / 2 - inv_h / 2, inv_w, inv_h); GUI.DrawTexture(windowRect, texture_inventory); //Drop Item if(!selectedItem.Equals(InventoryItem.NULL) && !selectedItem.item.getType().Equals("Placeable")) { if(GUI.Button(new Rect(10, 10, 100, 50), "Drop")) { if(selectedItem.status[0] > 1) //If stackable { selectedItem.status[0]--; } else { myInventory.myItems[(int)selectedPos.x, (int)selectedPos.y] = InventoryItem.NULL; myInventory.RemoveFromHotbar(selectedItem); } Network.Instantiate((Object)Resources.Load("Prefabs/Drop/" + selectedItem.item.Name), myTransform.position, Quaternion.identity, 2); selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } } //Draw Inventory Items for (int y = 0; y < myInventory.myItems.GetLength(1); y++) { for (int x = 0; x < myInventory.myItems.GetLength(0); x++) { Vector2 startPos = new Vector2(windowRect.x + 12f * screenSizeMultiplier, windowRect.y + 75f * screenSizeMultiplier); Vector2 pos = new Vector2(x, y); Vector2 btnPos = startPos + new Vector2(btnSize.x * screenSizeMultiplier * x + (12f * screenSizeMultiplier * x), btnSize.y * screenSizeMultiplier * y + (12f * screenSizeMultiplier * y)); if(myInventory.unlocked[x,y]) { if(myInventory.myItems[x,y].Equals(InventoryItem.NULL)) { //Trocar com o fists if (GUI.Button(new Rect(btnPos.x, btnPos.y, btnSize.x * screenSizeMultiplier, btnSize.y * screenSizeMultiplier), "")) { if(!selectedItem.Equals(InventoryItem.NULL)) { if (!selectedPos.Equals(new Vector2(29, 11))) myInventory.UpdateHotbar(selectedPos, new Vector2(x,y)); myInventory.myItems[x, y] = selectedItem; selectedItem = InventoryItem.NULL; if(!selectedPos.Equals(new Vector2(29, 11))) myInventory.myItems[(int)selectedPos.x, (int)selectedPos.y] = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } } } else { InventoryItem item = myInventory.myItems[x, y]; image = (Texture2D)Resources.Load("Textures/Items/" + item.item.ID); if(!selectedItem.Equals(InventoryItem.NULL)) { //We have a selected item, and we want to replace with other item. if (GUI.Button(new Rect(btnPos.x, btnPos.y, btnSize.x * screenSizeMultiplier, btnSize.y * screenSizeMultiplier), image)) { myInventory.myItems[(int)selectedPos.x, (int)selectedPos.y] = item; myInventory.myItems[x, y] = selectedItem; selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } if (item.status[1] != 0) //If its stackable { GUI.Label(new Rect(btnPos.x + (btnSize.x * screenSizeMultiplier / 2), btnPos.y + btnSize.y * screenSizeMultiplier - 20, 30, 20), "x" + item.status[0].ToString()); } } else { //We want to choose an item if (GUI.Button(new Rect(btnPos.x, btnPos.y, btnSize.x * screenSizeMultiplier, btnSize.y * screenSizeMultiplier), image)) { selectedItem = item; selectedPos = new Vector2(x, y); } if (item.status[1] != 0) //If its stackable { GUI.Label(new Rect(btnPos.x + (btnSize.x * screenSizeMultiplier / 2), btnPos.y + btnSize.y * screenSizeMultiplier - 20, 30, 20), "x" + item.status[0].ToString()); } } } } } } //Draw Hotbar with buttons float hotbar_w = texture_hotbar.width * screenSizeMultiplier; float hotbar_h = texture_hotbar.height * screenSizeMultiplier; GUI.DrawTexture(new Rect( Screen.width / 2 - hotbar_w / 2, Screen.height - hotbar_h, hotbar_w, hotbar_h), texture_hotbar); for(int i = 0; i < myInventory.myHotbar.Length; i++) { Vector2 hotbarItem = myInventory.myHotbar[i]; float img_w = 87 * screenSizeMultiplier; float img_h = 87 * screenSizeMultiplier; float base_x = Screen.width / 2 - hotbar_w / 2 + (12 * screenSizeMultiplier) + (img_w * i) + (12 * screenSizeMultiplier * i); float base_y = Screen.height - hotbar_h + 12; InventoryItem item = myInventory.getItemByPosition(myInventory.myHotbar[i]); Texture2D image = (Texture2D)Resources.Load("Textures/Items/" + item.item.ID); if(!hotbarItem.Equals(new Vector2(29, 11))) { if(item.item.ID != 0) { if (GUI.Button(new Rect(base_x, base_y, img_w, img_h), image)) { if(!selectedItem.Equals(InventoryItem.NULL)) { myInventory.myHotbar[i] = myInventory.getItemPosition(item.item); selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } else { if(Event.current.button == 1) { myInventory.myHotbar[i] = new Vector2(29, 11); } } } } } else { if (GUI.Button(new Rect(base_x, base_y, img_w, img_h), image)) { if(!selectedItem.Equals(InventoryItem.NULL)) { myInventory.myHotbar[i] = myInventory.getItemPosition(selectedItem.item); selectedItem = InventoryItem.NULL; selectedPos = new Vector2(29, 11); } } } } if(!selectedItem.Equals(InventoryItem.NULL)) { Texture2D image = (Texture2D)Resources.Load("Textures/Items/" + selectedItem.item.ID); GUI.Box(new Rect(mousePos.x, mousePos.y, btnSize.x, btnSize.y), image); } //Debug /* for (int y = 0; y < myInventory.myItems.GetLength(1); y++) { for (int x = 0; x < myInventory.myItems.GetLength(0); x++) { GUI.Label(new Rect(0 + x * 100, 0 + y * 20, 100, 20), myInventory.myItems[x, y].item.Name); } } for(int i = 0; i < myInventory.myHotbar.Length; i++) { GUI.Label(new Rect(0 + i * 100, 150, 100, 20), myInventory.myHotbar[i].ToString()); } GUI.Label(new Rect(0, 170, 500, 20), selectedItem.item.Name + " " + selectedPos.ToString()); * */ } else { //Draw Hotbar float hotbar_w = texture_hotbar.width * screenSizeMultiplier; float hotbar_h = texture_hotbar.height * screenSizeMultiplier; GUI.DrawTexture(new Rect( Screen.width / 2 - hotbar_w / 2, Screen.height - hotbar_h, hotbar_w, hotbar_h), texture_hotbar); //Draw Hotbar Items for (int i = 0; i < myInventory.myHotbar.Length; i++) { float img_w = 87 * screenSizeMultiplier; float img_h = 87 * screenSizeMultiplier; float base_x = Screen.width / 2 - hotbar_w / 2 + (12 * screenSizeMultiplier) + (img_w * i) + (12 * screenSizeMultiplier * i); float base_y = Screen.height - hotbar_h + 12; InventoryItem item = myInventory.getItemByPosition(myInventory.myHotbar[i]); //Item in the hotbar Texture2D image = (Texture2D)Resources.Load("Textures/Items/" + item.item.ID); GUI.DrawTexture(new Rect(base_x, base_y, img_w, img_h), image); } } } void AnimationController() { //Walk Animation if(myCharMotor.movement.velocity.magnitude >= 2) { if(!myHips.GetComponent<Animation>().isPlaying) { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 2, "Walk", true, 1.0f); } } //Weapons if(!mySpine.GetComponent<Animation>().isPlaying) { if (myInventory.getItemByPosition(myInventory.curItem).Equals(InventoryItem.NULL)) { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleFists", true, 1.0f); } else { if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("MeleeDual")) //Dual Wield { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleDualHands", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("MeleeSpear")) //Spear Wield { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "SpearIdle", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("MeleeOne")) //One hand weapon { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "OneHandIdle", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("Item")) //Item Idle { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleDualHands", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("Gun")) //Gun Idle { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleGunDualHands", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("Bow")) //Bow Idle { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleDualHands", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("Consumable")) //Bow Idle { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleDualHands", true, 1.0f); } else if (myInventory.getItemByPosition(myInventory.curItem).item.Type.Equals("Placeable")) //Bow Idle { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleDualHands", true, 1.0f); } else { GetComponent<NetworkView>().RPC("NetworkAnimation", RPCMode.All, 3, "IdleFists", true, 1.0f); } } } } void SpawnSound(Vector3 pos, string clipName) { GameObject go = (GameObject)Resources.Load("Prefabs/General/AudioSpawner"); go = Instantiate(go, pos, Quaternion.identity) as GameObject; go.GetComponent<AudioSource>().PlayOneShot((AudioClip)Resources.Load("Sounds/" + clipName)); } IEnumerator InstantiateAttack(Vector3 pos, Quaternion rot, string owner, int itemID, float delay) { yield return new WaitForSeconds(delay); SpawnSound(transform.position, db.Items[itemID].getAudioName()); if (!pos.Equals(mySpawnpoint.position)) { pos = mySpawnpoint.position; } if(!rot.Equals(Quaternion.Euler(mySpawnpoint.eulerAngles.x + 90, mySpawnpoint.eulerAngles.y, 0))) { rot = Quaternion.Euler(mySpawnpoint.eulerAngles.x + 90, mySpawnpoint.eulerAngles.y, 0); } GameObject go = Instantiate(AttackPrefabs[db.Items[itemID].getPrefabAttack()], pos, rot) as GameObject; MeleeAttack m = go.GetComponent<MeleeAttack>(); if(m != null) { m.owner = owner; m.weaponID = itemID; } else { go.GetComponent<Arrow>().owner = owner; go.GetComponent<Arrow>().weaponID = itemID; go.GetComponent<Rigidbody>().AddForce(mySpawnpoint.forward * arrowForce); } } public bool AddItemNetwork(InventoryItem item) { Vector2 slot = myInventory.getNextAvailableSlot(); if(myInventory.AddItem(item)) { GetComponent<NetworkView>().RPC("AddItemOverNetwork", RPCMode.OthersBuffered, item.item.ID, (int)slot.x, (int)slot.y); return true; } else { return false; } } public bool RemoveItemNetwork(InventoryItem item, int qtd) { Vector2 slot = myInventory.getItemPosition(item.item); if (myInventory.RemoveItem(item, qtd)) { GetComponent<NetworkView>().RPC("RemoveItemOverNetwork", RPCMode.OthersBuffered, item.item.ID, qtd); return true; } else { return false; } } public bool RemoveItemNetwork(List<InventoryItem> item) { for(int x = 0; x < item.Count; x++) { Vector2 slot = myInventory.getItemPosition(item[x].item); if (myInventory.RemoveItem(item[x], item[x].status[0])) { GetComponent<NetworkView>().RPC("RemoveItemOverNetwork", RPCMode.OthersBuffered, item[x].item.ID, item[x].status[0]); } } return true; } /* * RPC's */ [RPC] void SpawnAttack(Vector3 pos, Quaternion rot, string owner, int itemID) { StartCoroutine( InstantiateAttack( pos, rot, owner, itemID, db.Items[itemID].getAttackSpawnDelay() )); } [RPC] void NetworkAnimation(int trans, string anim, bool cf, float AnimSpeed) { if(myArray[trans] != null) myArray[trans].GetComponent<Animation>()[anim].speed = AnimSpeed; if (cf) //Crossfade? { myArray[trans].GetComponent<Animation>().CrossFade(anim); } else { myArray[trans].GetComponent<Animation>().Play(anim); } } [RPC] void SendCurrentItem(int x, int y) { myInventory.curItem = new Vector2(x, y); } [RPC] void DestroySelf() { Destroy(gameObject); } [RPC] void UpdateMyHealthEverywhere( float hp) { prevHealth = hp; } [RPC] void UpdateMyCurrentHealthEverywhere(float hP) { myHealth = hP; } [RPC] public void AddItemOverNetwork(int itemID, int x, int y) { multiplayer.GetComponent<Console>().Write("AddItemOverNetwork Called in player " + gameObject.name); Item i = GameObject.Find("MPManager").GetComponent<ItemDatabase>().getItemByID(itemID); myInventory.myItems[x, y] = new InventoryItem(i, InventoryItem.DefaultStatus(false, 0, 1)); multiplayer.GetComponent<Console>().Write("Item " + i.ToString() + " added to " + new Vector2(x,y).ToString() + " on player " + gameObject.name); } [RPC] public void RemoveItemOverNetwork(int itemID, int qtd) { multiplayer.GetComponent<Console>().Write("RemoveItemOverNetwork Called in player " + gameObject.name); Item i = GameObject.Find("MPManager").GetComponent<ItemDatabase>().getItemByID(itemID); InventoryItem itemToDelete = new InventoryItem(i, InventoryItem.DefaultStatus(false, 1, 1)); if (myInventory.RemoveItem(itemToDelete, qtd)) { multiplayer.GetComponent<Console>().Write("Item " + i.ToString() + " removed on player " + gameObject.name); } else { multiplayer.GetComponent<Console>().Error("Item couldn't be removed!"); } } } public class Inventory { public Vector2 curItem; public InventoryItem[,] myItems; public bool[,] unlocked; public Vector2[] myHotbar; public int maxItems; public List<InventoryItem> craftList; public Inventory() { curItem = new Vector2(29, 11); myItems = new InventoryItem[6, 5]; unlocked = new bool[6, 5]; craftList = new List<InventoryItem>(); myHotbar = new Vector2[5]; maxItems = 10; ItemDatabase db = GameObject.Find("MPManager").GetComponent<ItemDatabase>(); setupArray(); OpenSlots(12); AddItem(new InventoryItem(db.getItemByName("WoodAxe"), InventoryItem.DefaultStatus(false, 0, 1))); } public void UpdateHotbar(Vector2 old, Vector2 newpos) { for (int i = 0; i < myHotbar.Length; i++) { if (myHotbar[i].Equals(old)) myHotbar[i] = newpos; } } public void ClearCraftList() { for (int i = 0; i < craftList.Count; i++) { craftList[i] = InventoryItem.NULL; } } public void setupArray() { for (int i = 0; i < myHotbar.Length; i++) { myHotbar[i] = new Vector2(29, 11); } for (int y = 0; y < myItems.GetLength(1); y++) { for (int x = 0; x < myItems.GetLength(0); x++) { myItems[x, y] = InventoryItem.NULL; } } for (int i = 0; i < 4; i++) { craftList.Add(InventoryItem.NULL); } } public InventoryItem getItemByPosition(Vector2 pos) { if (isValid(pos)) { if (!myItems[(int)pos.x, (int)pos.y].Equals(InventoryItem.NULL)) { return myItems[(int)pos.x, (int)pos.y]; } else { return InventoryItem.NULL; } } return InventoryItem.NULL; } public Vector2 getItemPosition(Item item) { for (int y = 0; y < myItems.GetLength(1); y++) { for (int x = 0; x < myItems.GetLength(0); x++) { if (myItems[x, y] != null) { if (myItems[x, y].item.Equals(item)) { return new Vector2(x, y); } } } } return new Vector2(29, 11); } public Vector2 getNextAvailableSlot() { for (int y = 0; y < unlocked.GetLength(1); y++) { for (int x = 0; x < unlocked.GetLength(0); x++) { if (myItems[x, y].Equals(InventoryItem.NULL) && unlocked[x, y]) { return new Vector2(x, y); } } } return new Vector2(29, 11); } public Vector2 getNextSlot() { for (int y = 0; y < myItems.GetLength(1); y++) { for (int x = 0; x < myItems.GetLength(0); x++) { if (unlocked[x, y] == false) { return new Vector2(x, y); } } } return new Vector2(29, 11); } public static bool isValid(Vector2 validate) { return !validate.Equals(new Vector2(29, 11)); } public bool AddItem(InventoryItem newItem, Vector2 slot) { if (isValid(slot)) { if (newItem.status[1] != 0) //Item is stackable { if (isValid(getItemPosition(newItem.item)) && getItemByPosition(getItemPosition(newItem.item)).status[0] < 10) //Already exists, lets add to the stack. { int pos_x = (int)getItemPosition(newItem.item).x; int pos_y = (int)getItemPosition(newItem.item).y; myItems[pos_x, pos_y].status[0]++; //Increase the amount of the item return true; //Success on adding the item. } else //Item doesn't exist yet { myItems[(int)slot.x, (int)slot.y] = newItem; return true; } } else { //Item is not stackable, so add it to a new position myItems[(int)slot.x, (int)slot.y] = newItem; return true; } } return false; } public void OpenSlots(int amount) { Vector2 start = getNextSlot(); int done = 0; for (int y = (int)start.y; y < myItems.GetLength(1); y++) { for (int x = (int)start.x; x < myItems.GetLength(0); x++) { if (done < amount) { unlocked[x, y] = true; done++; } } } } public bool AddItem(InventoryItem item) { Vector2 position = getNextAvailableSlot(); if (isValid(position)) { if (AddItem(item, position)) { return true; } else { return false; } } return false; } public bool RemoveItem(InventoryItem item, int qtd) { Vector2 position = getItemPosition(item.item); if(isValid(position)) { InventoryItem i = myItems[(int)position.x, (int)position.y]; int itemQtd = i.status[0]; if(itemQtd - qtd < 1) { //Remover o item todo myItems[(int)position.x, (int)position.y] = InventoryItem.NULL; } else { i.status[0] -= qtd; } return true; } else { return false; } } public bool RemoveItem(List<InventoryItem> item) { for(int x = 0; x < item.Count; x++) { Vector2 position = getItemPosition(item[x].item); if (isValid(position)) { InventoryItem i = myItems[(int)position.x, (int)position.y]; int itemQtd = i.status[0]; if (itemQtd - item[x].status[0] < 1) { //Remover o item todo myItems[(int)position.x, (int)position.y] = InventoryItem.NULL; } else { i.status[0] -= item[x].status[0]; } } } return true; } public void RemoveFromHotbar(InventoryItem item) { Vector2 posToRemove = getItemPosition(item.item); for (int i = 0; i < myHotbar.Length; i++) { if (myHotbar[i].Equals(posToRemove)) { myHotbar[i] = new Vector2(29, 11); } } } } public class InventoryItem { public Item item; public List<int> status; public InventoryItem(Item i, List<int> s) { this.item = i; this.status = s; } public static List<int> DefaultStatus(bool stackable, int stackAmmount, int quantity) { //Status Configuration: //Quantity | Stackable | Ammo | Extra Ammo List<int> s = new List<int>(); if(stackable) { s.Add(quantity); //First is quantity s.Add(stackAmmount); //Second is stackable size } else { s.Add(quantity); //First Quantity s.Add(0); } s.Add(20); s.Add(40); return s; } public override string ToString() { if (item == null) return "Inv item with null item"; else return "InvItem | " + item.ToString(); } public static InventoryItem NULL = new InventoryItem(GameObject.Find("MPManager").GetComponent<ItemDatabase>().getItemByName("Fists"), null); }
  4. Hello there, I need some help with my cutscenes for my game. Making one long animation is hard and messes up a lot of things, so I came to a new idea but I've never did this before; maybe someone could help me, please. The goal is: The Main Camera-object, attached with the script below, should play several animations one after another (more than 3). It is not required to call them all by number-sorting but could also something be like: First: play animation (Cutscene_Intro) Second: play animation (AnotherOne) Third: play animation (FlyThroughHouse) This is the script I wrote: using UnityEngine; using System.Collections; public class AnimPlayCutsceneTest : MonoBehaviour { public Animation anim; public string AnimString = "TestCutscene"; void Start() { anim = GetComponent<Animation>(); } /*void Awake() { anim.PlayQueued(AnimString, QueueMode.PlayNow); }*/ void Awake () { animation.PlayQueued("TestCutscene2", QueueMode.PlayNow); animation.PlayQueued("TestCutscene1", QueueMode.CompleteOthers); } }
  5. Hi All i'm the founder of the V.A.G. Team(An italian indie team), in our team we have (2 Programmers, 2 Level Designers, 1 Concept Artist, 2 Animators, 3 3D Modellers). Now i wanna just explain our idea. We want to revolution the conception of FPS, because now it means (shoot and run with no sense and no why), we want to insert a Psicological part, with some input for the Player mind, that will costrict him to think and chose the best way to resolve critical situations. Plot : This game will talk about a Scientist Team that discovered a math error in Einstein's Relativity theory. So they invented an engine that can curve the light and go with a major velocity of it. But in their "Jump" they arrived too much near to an unkown planet. Its gravity Attracted Them to the planet ground. They used a capsule to escape from the MotherShip but landing in a very far area from it. Unfortunately in the mothership they had the main radio with the minimal power to talk with the earth. Their Trip for the radio will be Hampered by the local population that will defend their lands by the Human attack. We want to insert multiple Endings Allowing the greater experience and PlayingStyle of the players. To compleate our team we need : 1 2D Artist/Texturer ; 1 Programmer(C#) ; 1 Sound Designer We're using Unity of course. The project is just Begun so we haven't got any screen But i will insert them in a next update. Sorry, if i made mistakes See you soon
  6. Hey, I'm very bad with fantasy , And I'm a programmer and a modeler too, Very advanced with unity3d , And im looking for something to work on , would anyone have any ideas on what kinda game i could start working on, And if you want to help you can join me , I don't have to show alot of work but if you ask me i can try show you something, Just any ideas you have plot them down, i want to make something big, Or something you would like to see in the game, Thanks, Looking forward to your ideas.
  7. Hello I need some 3d models for unity. Houses would suffice and like a small market would be great. the houses dont really need to be AAA type quality. I just need Houses with a room and a kitchen and whatever just switch it up. the insides would have nothing just rooms to enter.. no doors or anything like that. for windows just leave it open.. i dont want any glass on it. and it should be open to where a person can walk inside and loot. Pm me if your interested and about pay and also just post here for more questions.
  8. Hallo i am making a horror game and i found a tut about how to make a flashlight use battery and now the funny thing comes. When i am playing the game in the Unity editor i can turn the flashligt off and on but if i build the game the flashligt dont work..Why I have contacted the guy who made this tut but have waited in 2 weeks for a anwser but he dont answer me so i wanna ask you guys and i have put my to scripts down below The guy in the tut called the script TorchController and so do i... TorchController.js : #pragma strict var torchClick : AudioClip; var flashLight : Light; var torchWind : AudioClip; function Start() { flashLight.light.enabled = false; flashLight.light.intensity = 2; } function Update() { if(flashLight.light.enabled == true) { flashLight.light.intensity -= 0.1 * Time.deltaTime / 5; //Debug.Log(flashLight.light.intensity); } if(Input.GetKeyDown("f")) { audio.PlayOneShot(torchClick); if(flashLight.light.enabled == false) { flashLight.light.enabled = true; } else { flashLight.light.enabled = false; } } if(flashLight.light.enabled == true && Input.GetKeyDown("q")) { flashLight.light.intensity += 0.05; audio.PlayOneShot(torchWind); } } BatteryPickup_Ray.js : private var torchScript : TorchController; private var guiShow : boolean = false; var battery : GameObject; var rayLength = 10; function Start() { torchScript = GameObject.Find("FlashLight").GetComponent(TorchController); } function OnGUI() { if(guiShow == true) { GUI.Box(Rect(Screen.width / 2, Screen.height / 2, 100, 25 ), "Pick up batteries!"); } } function Update() { //Debug.Log(guiShow); var hit : RaycastHit; var fwd = transform.TransformDirection (Vector3.forward); if (Physics.Raycast (transform.position, fwd, hit, rayLength)) { if(hit.collider.gameObject.tag == "Battery") { guiShow = true; if(Input.GetKeyDown("e")) { torchScript.flashLight.light.intensity += 0.5; Destroy(battery); guiShow = false; } } } else { guiShow = false; } }
  9. We need new team members, New team members are required to start a project named; Alpha Squad: Warzone. The game is going to be a Battlefield 4 inspired game, however it will be more realistic* If any Modelers/Animators/Scripters are interested in this project I would like to know; Age: Name: Previous projects?: Modeler/animator/scripter?: Timezone: Willing to work for free?: If any questions remain feel free to ask! *more realistic in the way of No HUD, No ammo counter, no kill report, no crosshairs etc.
  10. aradox

    lessons

    Hi there, it has been a while since i coded, and i forgot, i need some lessons but i don't understand anything form those online resources. so can somboidy please give me some lessons through skype. thanks Tim S. aka aradox
  11. Hello everybody, teamlight need a programmer for an Horror game like Slender but with another cool creepy monster The game since 10 month ago work every single day at today. This is the product for now: \//////////////////////////////////////////////////////// \/////// //////////\///////////////////////////////////////////////////// If you're a programmer and you like the project, we need you to continue this cool horror game, we need really simple script now. My skype: leonecaramanica or Facebook (GamePage): https://www.facebook.com/LUltimoBuccaggio Work = 95%
  12. Hello! I am in need of a map maker/modeler for my FPS game. NO PAY!! If you know of a good place to get a FPS map for free, please put in a link, and I will give you credit.
  13. I need somone to animate some of my guns with shoot, reload, prone, crouch, idle,walk, and run Ill send over my .fbx models add me one skype: res1st_skate
  14. Im working on a game (not so great now) and i need an animator so tell me what you can do maybe show me
×
×
  • Create New...