예제 #1
0
    void Start() //Called when start
    {
        if (description == "")
        {
            description = "";
        }
        if (scriptInteract != null)
        {
            intObj = new InteractObject(scriptInteract);
        }

        if (scriptTouch != null)
        {
            touObj = new TouchObject(scriptTouch);
        }

        if (showName) //Create floatingLabel
        {
            canvas = GameObject.Find("PopupUI");
            var popupText = Resources.Load("Prefabs/PopUpObject");
            floatingLabel = (GameObject)Instantiate(popupText);
            floatingLabel.transform.SetParent(canvas.transform);
            floatingLabel.transform.GetComponent <UnityEngine.UI.Text>().text = this.name;
        }
    }
예제 #2
0
 public void CheckStealObject(InteractObject obj, bool isLeavingZone)
 {
     InteractObject.ObjectType objectType = obj.objectType;
     if (objectType == InteractObject.ObjectType.Plante && characterOwner == PnjManager.CharacterType.Paysan)
     {
         if (isLeavingZone)
         {
             EventManager.Instance.UpdateEvent(EventDatabase.EventType.VolPlantePaysan, 1);
         }
         else
         {
             EventManager.Instance.UpdateEvent(EventDatabase.EventType.VolPlantePaysan, -1);
         }
     }
     else if (objectType == InteractObject.ObjectType.Fourche && characterOwner == PnjManager.CharacterType.Artisan)
     {
         if (isLeavingZone)
         {
             EventManager.Instance.UpdateEvent(EventDatabase.EventType.VolFourcheArtisan, 1);
         }
         else
         {
             EventManager.Instance.UpdateEvent(EventDatabase.EventType.VolFourcheArtisan, -1);
         }
     }
 }
예제 #3
0
    public static PacketWriter Add(IFieldObject <InteractObject> fieldInteractObject)
    {
        InteractObject interactObject = fieldInteractObject.Value;

        PacketWriter pWriter = PacketWriter.Of(SendOp.InteractObject);

        pWriter.Write(InteractObjectMode.Add);
        pWriter.WriteString(interactObject.Id);
        pWriter.Write(interactObject.State);
        pWriter.Write(interactObject.Type);
        pWriter.WriteInt(interactObject.InteractId);
        pWriter.Write(fieldInteractObject.Coord);
        pWriter.Write(fieldInteractObject.Rotation);
        pWriter.WriteUnicodeString(interactObject.Model);
        pWriter.WriteUnicodeString(interactObject.Asset);
        pWriter.WriteUnicodeString(interactObject.NormalState);
        pWriter.WriteUnicodeString(interactObject.Reactable);
        pWriter.WriteFloat(interactObject.Scale);
        pWriter.WriteByte();
        if (interactObject is AdBalloon adBalloon)
        {
            pWriter.WriteLong(adBalloon.Owner.CharacterId);
            pWriter.WriteUnicodeString(adBalloon.Owner.Name);
        }

        return(pWriter);
    }
예제 #4
0
    public static PacketWriter Add(InteractObject interactObject)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.INTERACT_OBJECT);

        pWriter.Write(InteractObjectMode.Add);
        pWriter.WriteString(interactObject.Id);
        pWriter.Write(interactObject.State);
        pWriter.Write(interactObject.Type);
        pWriter.WriteInt(interactObject.InteractId);
        pWriter.Write(interactObject.Position);
        pWriter.Write(interactObject.Rotation);
        pWriter.WriteUnicodeString(interactObject.Model);
        pWriter.WriteUnicodeString(interactObject.Asset);
        pWriter.WriteUnicodeString(interactObject.NormalState);
        pWriter.WriteUnicodeString(interactObject.Reactable);
        pWriter.WriteFloat(interactObject.Scale);
        pWriter.WriteByte();
        if (interactObject is AdBalloon adBalloon)
        {
            pWriter.WriteLong(adBalloon.Owner.CharacterId);
            pWriter.WriteUnicodeString(adBalloon.Owner.Name);
        }

        return(pWriter);
    }
예제 #5
0
    public bool SpecialObjectEvent(InteractObject obj)
    {
        if (!IsWaitingObject)
        {
            isQuestOnomatope = false;
            return(false);
        }
        bool returnVal = false;

        switch (obj.objectType)
        {
        case InteractObject.ObjectType.Baton:
            if (character == PnjManager.CharacterType.Artisan)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectBoisToArtisan, 1);
            }
            break;

        case InteractObject.ObjectType.Plante:
            if (character == PnjManager.CharacterType.Healer)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectPlanteToShaman, 1);
            }
            break;

        case InteractObject.ObjectType.Fourche:
            if (character == PnjManager.CharacterType.Paysan)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectFourcheToPaysan, 1);
            }
            break;

        case InteractObject.ObjectType.Potion:
            if (character == PnjManager.CharacterType.Pecheur)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectPotionToPecheur, 1);
            }
            break;

        default:
            break;
        }
        if (returnVal)
        {
            AkSoundEngine.PostEvent("UI_quest_success", gameObject);
            //PASSE LONOMATOPE EN QUEST
            AkSoundEngine.SetSwitch("NPC_mood", "Quest_end", gameObject);
            isQuestOnomatope = true;
        }
        else
        {
            isQuestOnomatope = false;
        }
        return(returnVal);
    }
예제 #6
0
 public PlayerInteractState(ObjectManager curObject, GameObject curObj, State playerCurState) : base(curObject)
 {
     stateName           = "PLAYER_INTERACT_STATE";
     this.curObject      = curObject;
     manager             = (PlayerManager)this.curObject;
     this.interactObject = curObj.GetComponent <InteractObject>();
     prevState           = playerCurState;
 }
예제 #7
0
    public static PacketWriter Set(InteractObject interactObject)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.INTERACT_OBJECT);

        pWriter.Write(InteractObjectMode.Set);
        pWriter.WriteInt(interactObject.InteractId);
        pWriter.Write(interactObject.State);
        return(pWriter);
    }
예제 #8
0
        void ManageInteractLabel(GameObject obj)
        {
            InteractObject iObj = obj.GetComponent <InteractObject>();

            if (iObj)
            {
                UI.GetComponent <UIManager>().SetObjectName(iObj.Name);
            }
        }
예제 #9
0
 private void PutFoodDown(InteractObject obj)
 {
     if (carry != null && obj.IsEmpty)
     {
         obj.AddFood(carry);
         carry             = null;
         carrySprite.color = new Color(1, 1, 1, 0.1f);
     }
 }
예제 #10
0
 public static void WriteInteractObject(PacketWriter pWriter, InteractObject interactObject)
 {
     pWriter.WriteMapleString(interactObject.Id);
     pWriter.WriteEnum(interactObject.State);
     pWriter.WriteEnum(interactObject.Type);
     if (interactObject.Type == InteractObjectType.Gathering)
     {
         pWriter.WriteInt();
     }
 }
예제 #11
0
    public static PacketWriter Interact(InteractObject interactObject)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.INTERACT_OBJECT);

        pWriter.Write(InteractObjectMode.Interact);
        pWriter.WriteByte();
        pWriter.WriteString(interactObject.Id);
        pWriter.Write(interactObject.Type);
        return(pWriter);
    }
예제 #12
0
 private static void WriteInteractObject(PacketWriter pWriter, InteractObject interactObject)
 {
     pWriter.WriteString(interactObject.Id);
     pWriter.Write(interactObject.State);
     pWriter.Write(interactObject.Type);
     if (interactObject.Type == InteractObjectType.Gathering)
     {
         pWriter.WriteInt();
     }
 }
예제 #13
0
    void ClearMiniGame(InteractObject taskObject)
    {
        if (directory.ModifyQuest(taskObject))
        {
            //인벤토리 내 해당 객체를 추가
            taskBar.AdjustTaskPoints(taskObject.taskPoints);
        }

        joystick.SetActive(true);
    }
예제 #14
0
    public static PacketWriter Remove(InteractObject interactObject)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.INTERACT_OBJECT);

        pWriter.Write(InteractObjectMode.Remove);
        pWriter.WriteString(interactObject.Id);
        pWriter.WriteUnicodeString();

        return(pWriter);
    }
예제 #15
0
 protected virtual void Awake()
 {
     dialogueManager    = GetComponent <PnjDialogueManager>();
     navAgent           = GetComponent <NavMeshAgent>();
     anim               = GetComponent <Animator>();
     interactionManager = GetComponent <InteractObject>();
     if (anim == null)
     {
         anim = GetComponentInChildren <Animator>();
     }
 }
예제 #16
0
    public static PacketWriter Update(InteractObject interactObject)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.InteractObject);

        pWriter.Write(InteractObjectMode.Update);
        pWriter.WriteString(interactObject.Id);
        pWriter.Write(interactObject.State);
        pWriter.Write(interactObject.Type);

        return(pWriter);
    }
예제 #17
0
 //근처 미션이 가능한 오브젝트 있을 경우 사용이 가능하며
 //해당 미션오브젝트의 정보를 전달받아야합니다
 //해당 미션에 해당하는 미니게임을 나타내야합니다.
 public void InteractMissionObject(InteractObject obj)
 {
     if (obj.objectType == InteractObject.ObjectType.COIN)
     {
         street_lamp.SetActive(true);
         visual_joystick.SetActive(false);
         ChangeButtonUI(false);
     }
     else if (obj.objectType == InteractObject.ObjectType.HEART)
     {
     }
 }
예제 #18
0
        private static void HandleCast(GameSession session, PacketReader packet)
        {
            string         id             = packet.ReadMapleString();
            InteractObject interactObject = session.FieldManager.State.InteractObjects[id];

            if (interactObject == null)
            {
                return;
            }

            // TODO: Change state of object only if player succeeds in the cast.
        }
예제 #19
0
 private void CollectIngredients(InteractObject obj)
 {
     if (carry == null)
     {
         carry = obj.GetFood();
     }
     else
     {
         carry.Merge(obj.GetFood());
     }
     carrySprite.color = new Color(1, 1, 1, Mathf.Clamp01(0.2f * carry.ZutatenListe.Count));
     carryBounce.StartAnimating();
 }
예제 #20
0
    public IInteractableObject PopFromStackObject()
    {
        if (m_stackItem.Count > 0)
        {
            IInteractableObject interactObject = m_stackItem.Pop();

            InteractObject obj = interactObject as InteractObject;
            obj.OnPopFromStack();

            return(interactObject);
        }

        return(null);
    }
예제 #21
0
 //근처 미션이 가능한 오브젝트 있을 경우 사용이 가능하며
 //해당 미션오브젝트의 정보를 전달받아야합니다
 //해당 미션에 해당하는 미니게임을 나타내야합니다.
 public void InteractMissionObject(InteractObject obj)
 {
     if (obj.isItUsable == false)
     {
         if (obj.objectType == InteractObject.ObjectType.BASKETBALL_HOOP)
         {
             miniGame[0].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.SAFE)
         {
             miniGame[1].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.SHELF)
         {
             miniGame[2].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.GAS_STATION)
         {
             miniGame[3].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.COIN)
         {
             miniGame[4].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.VACCINE)
         {
             miniGame[5].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.POWER_SUPPLY)
         {
             miniGame[6].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.COFFIN)
         {
             miniGame[7].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.BOOK)
         {
             miniGame[8].SetActive(true);
         }
         else if (obj.objectType == InteractObject.ObjectType.BELL)
         {
             bell_script        = bell_panel.transform.GetChild(1).transform.GetChild(0).GetComponent <Bell>();
             bell_script.player = player;
             bell_panel.SetActive(true);
         }
         joystick.SetActive(false);
         ChangeButtonUI(false);
     }
 }
예제 #22
0
    public void AddInteractState(InteractObject interactObject)
    {
        InteractState state = new InteractState()
        {
            ID             = interactObject.ID,
            inspectText    = interactObject.inspectText,
            itemId         = interactObject.itemId,
            interactItemId = interactObject.interactItemId,
            hasItem        = interactObject.hasItem,
            interactable   = interactObject.interactable
        };

        Objects.Add(state);
    }
예제 #23
0
    // TODO: Changer le 'E' en la touche que le joueur choisira
    private string CanPerformAnActionValue(InteractObject interactObject, RaycastHit raycastHit)
    {
        switch (interactObject)
        {
        case InteractObject.CollectableObject:
            return("E - " + Lang.GetString("controller.action.pickup") + " " + Lang.GetString(raycastHit.collider.gameObject.GetComponent <Item>().itemName));

        case InteractObject.LivingEntity:
            return(raycastHit.collider.gameObject.name);

        default:
            return("");
        }
    }
예제 #24
0
    public void SetInteractObject(int[] interactObjectIds, byte state, bool arg4, bool arg3)
    {
        InteractObjectState objectState = (InteractObjectState)state;

        foreach (int interactObjectId in interactObjectIds)
        {
            InteractObject interactObject = Field.State.InteractObjects.Values.FirstOrDefault(x => x.InteractId == interactObjectId);
            if (interactObject == null)
            {
                continue;
            }
            interactObject.State = objectState;
            Field.BroadcastPacket(InteractObjectPacket.Set(interactObject));
        }
    }
예제 #25
0
 public void UpdateObject(InteractObject interactObject)
 {
     foreach (InteractState obj in Objects)
     {
         if (obj.ID == interactObject.ID)
         {
             obj.inspectText    = interactObject.inspectText;
             obj.itemId         = interactObject.itemId;
             obj.interactItemId = interactObject.interactItemId;
             obj.hasItem        = interactObject.hasItem;
             obj.interactable   = interactObject.interactable;
             break;
         }
     }
 }
    void Ray()
    {
        Vector2      rayPosition = new Vector2(GameManager.instance.mainCamera.ScreenToWorldPoint(Input.mousePosition).x, GameManager.instance.mainCamera.ScreenToWorldPoint(Input.mousePosition).y);
        RaycastHit2D hit         = Physics2D.Raycast(rayPosition, Vector2.zero, 0f);

        if (hit)
        {
            io = hit.transform.GetComponent <InteractObject>();
            Debug.Log("Clicked on " + hit.transform.name);
        }
        else
        {
            io = null;
        }
    }
    public void Show(object Owner)
    {
        if (Owner.GetType() == typeof(InteractObject))
        {
            m_Obj = (InteractObject)Owner;
            ShowForInteract(m_Obj);
        }
        else if (Owner.GetType() == typeof(Unit))
        {
            m_Unit = (Unit)Owner;
            ShowForUnit(m_Unit);
        }

        base.Show(true);
    }
예제 #28
0
        public static Packet Use(InteractObject interactObject, short result = 0, int numDrops = 0)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.INTERACT_OBJECT);

            pWriter.WriteEnum(InteractObjectMode.Use);
            pWriter.WriteMapleString(interactObject.Id);
            pWriter.WriteEnum(interactObject.Type);

            if (interactObject.Type == InteractObjectType.Gathering)
            {
                pWriter.WriteShort(result);
                pWriter.WriteInt(numDrops);
            }
            return(pWriter);
        }
예제 #29
0
    public void OnVictory()
    {
        IInteractableObject[] arr = m_stackItem.ToArray();

        for (int i = 0; i < arr.Length; i++)
        {
            InteractObject obj = arr[i] as InteractObject;

            if (obj == null)
            {
                continue;
            }

            obj.FlyAway();
        }
    }
예제 #30
0
    public void OnFade()
    {
        IInteractableObject[] arr = m_stackItem.ToArray();

        for (int i = 0; i < arr.Length; i++)
        {
            InteractObject obj = arr[i] as InteractObject;

            if (obj == null)
            {
                continue;
            }

            obj.EnterCollisionToCameraRay();
        }
    }
예제 #31
0
    public void ClearMiniGame(InteractObject taskObject)
    {
        if (directory.ModifyQuest(taskObject))
        {
            //미션을 클리어할 때마다 서버에 알림
            TaskBarScore Taskbarscore = new TaskBarScore();
            Taskbarscore.taskbarscore = taskObject.taskPoints;
            string data = JsonUtility.ToJson(Taskbarscore, prettyPrint: true);
            Debug.Log("데이터 : " + data);
            SocketManger.Socket.Emit("SendMissionScore", data);
            //인벤토리 내 해당 객체를 추가
            taskBar.AdjustTaskPoints(taskObject.taskPoints);
            //서버에서는 broadcast를 하도록 한다.
        }

        joystick.SetActive(true);
    }
예제 #32
0
 public void Interact(InteractObject Obj)
 {
     Gameplay.ProcessInteraction(this, Obj);
 }
 void ShowForInteract(InteractObject Obj)
 {
     if (!Obj.IsContainer)
         return;
     base.SetItems(Obj.ContainedItems);
 }