예제 #1
0
    void Start()
    {
        for (int i = 0; i < numBee; i++)
        {
            Vector3 pos = new Vector3(
                Random.Range(-tankSize, tankSize) +
                transform.position.x,

                Random.Range(-tankSize, tankSize) +
                transform.position.y,

                Random.Range(-tankSize, tankSize) +
                transform.position.z);
            // allBee[i] = (GameObject)Instantiate(BeePrefab, pos, Quaternion.identity);

            var Bee = (GameObject)Instantiate(BeePrefab, pos, Quaternion.identity);
            Bee.transform.SetParent(transform);
            NetworkServer.Spawn(Bee);

            SendMsgManager.GetInstance().SetParentBeeFlock(this.gameObject, Bee);


            allBee[i] = Bee;
        }
    }
예제 #2
0
 private void OnTriggerEnter(Collider other)
 {
     //곰 도망
     if (other.CompareTag("Bear"))
     {
         GameController.GetInstance().ActionMessage("Right", "곰에게 후추스프레이를 뿌렸습니다.", this.transform.parent.gameObject);
         SendMsgManager.GetInstance().PepperUse(other.gameObject);
     }
 }
예제 #3
0
 void OnTriggerEnter(Collider other)
 {
     //살충제 범위 안으로 벌이 들어오면 벌 제거
     if (other.tag == "BeeClone")
     {
         Debug.Log(other.tag);
         GameController.GetInstance().ActionMessage("Right", "벌에게 스프레이를 뿌렸습니다.", this.transform.parent.gameObject);
         SendMsgManager.GetInstance().DestroyBee(other.gameObject.transform.parent.gameObject);
     }
 }
예제 #4
0
 public void ActionMessage(string type, string message, GameObject player)
 {
     if (player.GetComponent <SurvivorStatus>().isLocalPlayer)
     {
         StartActionMessage(type, message);
     }
     else
     {
         SendMsgManager.GetInstance().SendActionMessageMsg(type, message, player);
     }
 }
예제 #5
0
    public virtual void Play(string AudioName, GameObject Player)
    {
        if (!AudioDictionary.ContainsKey(AudioName))
        {
            Debug.Log(gameObject.name + "에 " + AudioName + "라는 AudioClip이 없습니다.");
            return;
        }

        int index = Random.Range(0, AudioDictionary[AudioName].Length);

        SendMsgManager.GetInstance().SendAudioPlayMsg(gameObject, AudioName, index, Player);
    }
예제 #6
0
    IEnumerator WaitThrowItem()
    {
        while (true)
        {
            yield return(new WaitForSeconds(1.0f));

            if (Inventory.GetThrowItem() != null)
            {
                SendMsgManager.GetInstance().BearAttention(survivorStatus.bigWild, Inventory.GetThrowItem());
                break;
            }
        }
    }
예제 #7
0
    public virtual void Stop(string AudioName)
    {
        if (!AudioDictionary.ContainsKey(AudioName))
        {
            Debug.Log(gameObject.name + "에 " + AudioName + "라는 AudioClip이 없습니다.");
            return;
        }

        for (int i = 0; i < AudioDictionary[AudioName].Length; i++)
        {
            if (AudioDictionary[AudioName][i].isPlaying)
            {
                SendMsgManager.GetInstance().SendAudioStopMsg(gameObject, AudioName, i);
            }
        }
    }
예제 #8
0
    void dead()
    {
        if (!isDead)
        {
            if (isLocalPlayer)
            {
                GameController.GetInstance().GameOver();
                GameController.GetInstance().BackGroundAudio.StopBGM();
            }

            CmdSetIsDead(true);

            SendMsgManager.GetInstance().SendToServerSurvivorUIMsg("null");
            SendMsgManager.GetInstance().SendToServerSurvivorDeadMsg(playerID.ToString());
        }
    }
예제 #9
0
파일: Trap.cs 프로젝트: tdm1223/WildLife
    public void Locate()
    {
        RaycastHit rayHit;

        if (Physics.Raycast(owner.transform.position + owner.transform.forward * 2 + Vector3.up, Vector3.down, out rayHit, 100))
        {
            if (rayHit.collider.gameObject.layer == 9)
            {
                SendMsgManager.GetInstance().LocateTrap(this.gameObject, rayHit.point);
            }
            else
            {
                useCount++;
            }
        }
    }
예제 #10
0
    void SelectItem(int pos)
    {
        if (Inventory.isNotNull(pos))//해당칸이 비어있지 않으면
        {
            UsingItemPos = pos;

            if (UsingItem != null) //기존의 착용하고 있던 아이템 분리
            {
                SendMsgManager.GetInstance().UnEquipItem(UsingItem.gameObject);
            }

            UsingItem = Inventory.getItem(UsingItemPos);

            SendMsgManager.GetInstance().UnEquipItem(UsingItem.gameObject);
            SendMsgManager.GetInstance().EquipItem(UsingItem.gameObject);
            Inventory.uiInventory.SendMessage("SelectItem", pos, SendMessageOptions.DontRequireReceiver);
        }
    }
예제 #11
0
파일: Item.cs 프로젝트: tdm1223/WildLife
    protected virtual void GetItem(SurvivorController itemOwner)
    {
        if (OnField)
        {
            Owner = itemOwner.gameObject; // 아이템의 소유자를 지정한다.

            Transform[] children = Owner.GetComponentsInChildren <Transform>();
            foreach (Transform child in children)
            {
                if (child.CompareTag(EquipTag))
                {
                    EquipPoint = child;
                }
            }

            if ((kind == 101 && Owner.GetComponent <SurvivorInventory>().GetMax() < 6))
            {
                GameController.GetInstance().ItemSpawnManager.ReduceItemNumber();
                if (Audio != null)
                {
                    Audio.Play(owner, "PickUp");
                }

                SendMsgManager.GetInstance().SendPickUpItemMsg(gameObject, Owner.gameObject);
                itemOwner.Pickup(this);
            }
            else if (((itemOwner.GetEmptySLotBool() || Owner.GetComponent <SurvivorInventory>().GetBundleItem(this)) && kind != 101))
            {
                GameController.GetInstance().ItemSpawnManager.ReduceItemNumber();
                if (Audio != null)
                {
                    Audio.Play(owner, "PickUp");
                }
                SendMsgManager.GetInstance().SetNetworkTransformFalse(this.gameObject, false);
                SendMsgManager.GetInstance().SendPickUpItemMsg(gameObject, Owner);


                itemOwner.Pickup(this);

                OnField = false;
                transform.SetPositionAndRotation(transform.position + Vector3.down * 100f, Quaternion.identity);
            }
        }
    }
예제 #12
0
 public override void Use(int pos)
 {
     base.Use(pos);
     if (Owner.GetComponent <SurvivorStatus>().UmbrellaState == false)
     {
         Owner.GetComponent <SurvivorStatus>().SetUmbrellaState(true);
         SendMsgManager.GetInstance().SendUmbrellaAnimSyncMsg(gameObject, true);
         instantiateUmbrellaCollider = (GameObject)Instantiate(umbrellaCollider) as GameObject;
         instantiateUmbrellaCollider.transform.SetParent(Owner.transform);
         instantiateUmbrellaCollider.transform.localPosition = new Vector3(0, 0, 0);
         instantiateUmbrellaCollider.transform.localRotation = Quaternion.identity;
         Destroy(instantiateUmbrellaCollider, 1f);
     }
     else if (Owner.GetComponent <SurvivorStatus>().UmbrellaState == true)
     {
         Owner.GetComponent <SurvivorStatus>().SetUmbrellaState(false);
         SendMsgManager.GetInstance().SendUmbrellaAnimSyncMsg(gameObject, false);
     }
 }
예제 #13
0
    public void ThrowItem(int pos)
    {
        Item item = getItem(pos);
        //ItemSlot Slot = getslot(pos);
        var UseCount = item.useCount;
        var Owner    = item.Owner;

        if ((item.Kind / 100 == 1))
        {
            //SendMsgManager.GetInstance().SetNetworkTransformFalse(item.gameObject, true);
            RemoveItem(pos);
            SendMsgManager.GetInstance().TFTrue(item.gameObject);

            //item.UnHold();
            SpawnObject(item.gameObject, Owner.transform.position + Owner.transform.forward + Vector3.up, gameObject.name);

            CmdDestroyItem(item.gameObject);
        }
        else if (UseCount > 1)
        {
            //SendMsgManager.GetInstance().SetNetworkTransformFalse(item.gameObject, true);
            //Transform child = Slot.transform.GetChild((UseCount - 2));
            ControlUseCount(pos, -1);
            SendMsgManager.GetInstance().TFTrue(item.gameObject);

            //item.UnHold();
            SpawnObject(item.gameObject, Owner.transform.position + Owner.transform.forward + Vector3.up, gameObject.name);
            SendMsgManager.GetInstance().UnEquipItem(item.gameObject);
        }
        else if (UseCount < 2) // 번들이 아니거나 번들의 마지막 아이템이면 버린다.
        {
            //SendMsgManager.GetInstance().SetNetworkTransformFalse(item.gameObject, true);
            ControlUseCount(pos, -1);
            RemoveItem(pos);

            SendMsgManager.GetInstance().TFTrue(item.gameObject);
            //item.UnHold();

            SpawnObject(item.gameObject, Owner.transform.position + Owner.transform.forward + Vector3.up, gameObject.name);
            CmdDestroyItem(item.gameObject);
        }
    }
예제 #14
0
 void SendStartBigWildSpawnMsg()
 {
     SendMsgManager.GetInstance().SendStartBigWildSpawnMsg("null");
 }
예제 #15
0
 void SendStartClockMsg()
 {
     SendMsgManager.GetInstance().SendStartClockMsg();
 }
예제 #16
0
 void SendWriteStartingMessageTextMsg()
 {
     SendMsgManager.GetInstance().SendWriteMessgeMsg("최후의 1인으로 살아남으세요!");
 }
예제 #17
0
    public void AddItem(Item item)
    {
        if (GetBundleItem(item)) //아이템이 번들일 경우
        {
            //Debug.Log("인벤토리 번들");
            Item     CurrentItem;
            ItemSlot CurrentItemSlot;

            for (int i = 0; i < Max; i++)
            {
                CurrentItem = getItem(i);

                CurrentItemSlot = getslot(i);

                if (CurrentItem == null)
                {
                    continue;
                }
                else if (CurrentItem.ItemName.Equals(item.ItemName) && !CurrentItemSlot.IsBundleFull())//번들이고 같은 슬롯안에 똑같은 이름이 있는 슬롯을 찾아서 use Count++
                {
                    //CurrentItem.UseCount++;//갯수 늘리고
                    ControlUseCount(i, 1);
                    //item.SetEquip(false);
                    CmdDestroyItem(item.gameObject);
                    //item.transform.SetParent(CurrentItem.transform);//겹치는 아이템 자식 아래로 세팅

                    //item.transform.SetParent(CurrentItemSlot.transform);///////////////////////////////////////////////////////////////////

                    //Debug.Log("번들 하나 증가");

                    break;
                }
                // }
            }
        }

        else if (!GetBundleItem(item)) //아이템 번들이 꽉차있거나 처음 먹는 경우
        {
            for (int i = 0; i < Max + 1; i++)
            {
                if (ItemList[i].GetComponent <ItemSlot>().IsEmpty) //해당 슬롯이 비어있으면
                {
                    if (item.Kind == 101)                          //가방이면 슬롯에 넣지않고 아이템 확장
                    {
                        ExtendInventory();

                        ChangeEmptySlotcount(2);

                        uiInventory.SendMessage("ExtendInventory", null, SendMessageOptions.DontRequireReceiver); //인벤토리 UI에 가방 먹은걸 알림

                        SendMsgManager.GetInstance().EquipItem(item.gameObject);

                        Debug.Assert(EmptySlotCount <= Max, "슬롯갯수가 Max 보다 커짐 씨발");
                        break;
                    }
                    else
                    {
                        var slot = ItemList[i].GetComponent <ItemSlot>();

                        slot.AddItem(item);
                        ChangeEmptySlotcount(-1);

                        item.Passive(); //먹을때 발생하는 효과 발동

                        object[] parameter = new object[3];
                        parameter[0] = i;
                        parameter[1] = item.ItemName;
                        parameter[2] = item.ItemIcon;
                        uiInventory.SendMessage("AddItem", parameter, SendMessageOptions.DontRequireReceiver); //인벤토리 UI에 아이템 먹은걸 알림
                        ControlUseCount(i, 0);
                        Debug.Assert(EmptySlotCount > -1, "슬롯갯수가 음수가됨 씨발");
                        //Debug.Log("남은슬롯갯수" + EmptySlotCount);
                        break;
                    }
                }
            }
        }
    }