public void Start() { instance = this; theAnimator = GetComponent <Animator>(); m_delivery = GameManager.instance.deliverGO; m_deliveryPoint = GameManager.instance.deliverPoint; }
override public void PickUpObject(PickUpSystem WhoPicked) { health cmp = WhoPicked.gameObject.GetComponent <health>(); Debug.Log(WhoPicked.name + "Picked Up HP"); if (cmp.hp + hp <= cmp.maxhp) { //cmp.Ammo[weaponid] += numberofammo; cmp.Heal(hp); //WhoPicked.Global.PickUps.Remove(this); if (photonView.IsMine) //Destroy(this.gameObject); { PhotonNetwork.Destroy(this.gameObject); //Destroy(this.gameObject); } else // Вроде и так работает, но на всякий { //photonView.RequestOwnership(); //PhotonNetwork.Destroy(this.gameObject); Debug.Log("transfering ownership from " + photonView.Owner.NickName); //photonView.RequestOwnership(); //photonView.TransferOwnership(PhotonNetwork.LocalPlayer); //Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); photonView.SetOwnerInternal(PhotonNetwork.LocalPlayer, PhotonNetwork.LocalPlayer.ActorNumber); Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); PhotonNetwork.Destroy(this.gameObject); } } else { hp -= cmp.maxhp - cmp.hp; cmp.Heal(cmp.maxhp - cmp.hp); } }
override public void PickUpObject(PickUpSystem WhoPicked) { WeaponHolder cmp = WhoPicked.gameObject.GetComponentInChildren <WeaponHolder>(); Debug.Log(WhoPicked.name + "Picked Up Ammo"); if (cmp.Ammo[weaponid] + numberofammo <= cmp.maxAmmo[weaponid]) { cmp.Ammo[weaponid] += numberofammo; //WhoPicked.Global.PickUps.Remove(this); if (photonView.IsMine) { PhotonNetwork.Destroy(this.gameObject); //Destroy(this.gameObject); } else // Вроде и так работает, но на всякий { Debug.Log("transfering ownership from " + photonView.Owner.NickName); //photonView.RequestOwnership(); //photonView.TransferOwnership(PhotonNetwork.LocalPlayer); //Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); photonView.SetOwnerInternal(PhotonNetwork.LocalPlayer, PhotonNetwork.LocalPlayer.ActorNumber); Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); PhotonNetwork.Destroy(this.gameObject); } } else { numberofammo -= cmp.maxAmmo[weaponid] - cmp.Ammo[weaponid]; cmp.Ammo[weaponid] = cmp.maxAmmo[weaponid]; } }
void Start() { rb = GetComponent <Rigidbody>(); Points = 0; SetCountText(); winText.text = ""; GameOver = false; PickUpSystem = GameObject.FindGameObjectWithTag("Pick Ups").GetComponent <PickUpSystem>(); }
/* * override public bool DistanceCriteria(PickUpSystemTrigger WhoPicked) * { * if ((WhoPicked.transform.position - this.transform.position).magnitude <= distance) return true; * return false; * } */ override public bool PickUpCriteria(PickUpSystem WhoPicked) { health cmp = WhoPicked.gameObject.GetComponent <health>(); if (cmp.hp >= cmp.maxhp) { return(false); } return(true); }
/* * override public bool DistanceCriteria(PickUpSystemTrigger WhoPicked) * { * if ((WhoPicked.transform.position - this.transform.position).magnitude <= distance) return true; * return false; * } */ override public bool PickUpCriteria(PickUpSystem WhoPicked) { WeaponHolder cmp = WhoPicked.gameObject.GetComponentInChildren <WeaponHolder>(); if (cmp.Ammo[weaponid] >= cmp.maxAmmo[weaponid]) { return(false); } return(true); }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; StartCoroutine(SpawnPickUps()); }
void Awake() { levelIsStarting = true; // Assign the corresponding gameObject to the Transform variables. panel = transform.Find("Panel"); shopIcon = panel.Find("shopIcon"); money = panel.Find("money"); totalMoneyEarned = panel.Find("totalEarned"); container = panel.Find("container"); shopItemTemplate = container.Find("shopItemTemplate"); holdingText = panel.Find("holdingText"); puSystem = player.GetComponent <PickUpSystem>(); plMovement = player.GetComponent <PlayerMovement>(); lvlSystem = player.GetComponent <LevelSystem>(); // Start game with 0 "money" moneyCount = 0; // Add an item to the list of shopitems -> Image, Name, Cost, Position //----------------------------------------------------------------------------------------- // Simply add a new item by adding in a new line below, use the following template // TEMPLATE: createItemSlot(item[X]Image, item[X]Name, [item name] .ToString(), [next number]); // Make sure to also add the image above at (//-------------------- Product Image --------------------//) // Make sure to also add the price above at (//-------------------- Shop price --------------------//) // Make sure to also add the index below at (//-------------------- Button-usability --------------------//) //----------------------------------------------------------------------------------------- createItemSlot(item1Image, item1Name, timePrice.ToString(), 1); createItemSlot(item2Image, item2Name, speedPrice.ToString(), 2); createItemSlot(item3Image, item3Name, carryPrice.ToString(), 3); createItemSlot(item4Image, item4Name, advertPrice.ToString(), 4); createItemSlot(item5Image, item5Name, valuePrice.ToString(), 5); // Set template-shopitem to invisible. shopItemTemplate.gameObject.SetActive(false); }
virtual public void PickUpObject(PickUpSystem WhoPicked) { }
/* * virtual public bool DistanceCriteria(PickUpSystemTrigger WhoPicked) * { * return false; * } */ virtual public bool PickUpCriteria(PickUpSystem WhoPicked) { return(false); }