示例#1
0
文件: Data.cs 项目: justi1jc/FPS
 public Data(Data dat)
 {
     if (dat == null)
     {
         return;
     }
     readyToRead     = dat.readyToRead;
     prefabName      = dat.prefabName;
     displayName     = dat.displayName;
     x               = dat.x;
     y               = dat.y;
     z               = dat.z;
     xr              = dat.xr;
     yr              = dat.yr;
     zr              = dat.zr;
     itemType        = dat.itemType;
     stack           = dat.stack;
     stackSize       = dat.stackSize;
     lastPos         = dat.lastPos;
     baseValue       = dat.baseValue;
     ints            = dat.ints;
     strings         = dat.strings;
     floats          = dat.floats;
     inventoryRecord = dat.inventoryRecord;
     bools           = dat.bools;
     speechTree      = dat.speechTree;
     equipSlot       = dat.equipSlot;
     doll            = dat.doll;
 }
示例#2
0
文件: Data.cs 项目: justi1jc/FPS
 public Data()
 {
     ints            = new List <int>();
     strings         = new List <string>();
     floats          = new List <float>();
     inventoryRecord = null;
     bools           = new List <bool>();
     speechTree      = null;
     equipSlot       = null;
     doll            = null;
 }
示例#3
0
    void LoadRight()
    {
        playerAnswerTree         = ray.hitObj.GetComponent <NPCDialogue>().playerRightSpeechTree;
        playerAnswer             = playerAnswerTree.dailyScripts[gm.dayCount];
        textManager.playerAnswer = playerAnswer;

        npcAnswerTree = ray.hitObj.GetComponent <NPCDialogue>().nPCRightSpeechTree;
        npcAnswer     = npcAnswerTree.dailyScripts[npcAnswerTree.dayCount];
        textManager.nPCAnswerSpeech = npcAnswer;

        image.texture = npcAnswer.drugSprite;
    }
示例#4
0
    public override void Render()
    {
        Actor actor = manager.actor;

        if (!actor)
        {
            MonoBehaviour.print("Actor missing"); return;
        }
        if (actor.interlocutor == null)
        {
            MonoBehaviour.print("Interlocutor missing");
            return;
        }
        if (actor.interlocutor.speechTree == null)
        {
            MonoBehaviour.print("tree missing.");
            return;
        }

        GUI.skin.button.wordWrap = true; // Make sure text wraps in buttons.
        GUI.skin.box.wordWrap    = true; // Make sure text wraps in boxes.

        Box("", XOffset(), 0, Width(), Height());
        SpeechTree st  = actor.interlocutor.speechTree;
        int        iw  = Width() / 6;
        int        ih  = Height() / 15;
        int        mid = Height() / 2;
        string     str = "";

        if (Button("Trade", XOffset(), Height() / 2, iw, ih))
        {
            manager.Change("TRADE");
            Sound(0);
        }

        // Render Prompt
        str = st.Prompt();
        Box(str, XOffset() + iw, 0, 4 * iw, 7 * ih);

        int i = 0;

        while (st.Option(i) != "")
        {
            str = st.Option(i);
            if (Button(str, XOffset() + iw, (7 + i) * ih, 4 * iw, 1 * ih))
            {
                st.SelectOption(i); Sound(0);
            }
            i++;
        }
    }
示例#5
0
    public override void UpdateFocus()
    {
        Actor actor = manager.actor;

        if (actor == null)
        {
            return;
        }
        SpeechTree st = actor.interlocutor != null ? actor.interlocutor.speechTree : null;

        if (st != null && st.Option(sy) == "")
        {
            sy--;
        }
    }
示例#6
0
 /* Loads data not specified for this prefab for this Actor */
 public void LoadData(Data dat)
 {
     displayName = dat.displayName;
     transform.position = new Vector3(dat.x, dat.y, dat.z);
     transform.rotation = Quaternion.identity;
     headRotx = dat.xr;
     headRoty = dat.yr;
     bodyRoty = dat.yr;
     int i = 0;
     arms = dat.equipSlot;
     doll = dat.doll;
     arms.Load(offHand, hand, this);
     inventory.LoadData(dat.inventoryRecord);
     id = dat.ints[i]; i++;
     lastPos = dat.lastPos;
     speechTree = dat.speechTree;
 }
示例#7
0
    public override void Input(int button)
    {
        DefaultExit(button);
        if (manager.actor == null || manager.actor.interlocutor == null)
        {
            return;
        }
        SpeechTree st = manager.actor.interlocutor.speechTree;

        if (button == A)
        {
            Sound(0);
            if (st.Option(sy) == "")
            {
                return;
            }
            switch (sy)
            {
            case 0:
                st.SelectOption(0);
                break;

            case 1:
                st.SelectOption(1);
                break;

            case 2:
                st.SelectOption(2);
                break;

            case 3:
                st.SelectOption(3);
                break;
            }
            sy = 0;
        }
    }
示例#8
0
 /* 0 No AI
   *  1-4 Input routine + initialize HUD
   *  >4 Initialize AI module
   */
 void AssignPlayer(int player)
 {
     playerNumber = player;
     if(arms.Empty()){
       arms.EquipAbility(Item.GetItem("Abilities/Unarmed"));
     }
     StartCoroutine(RegenRoutine());
     if(player <5 && player > 0){
       SetMenuOpen(false);
       if(menu){ menu.Change("HUD");  menu.actor = this; }
       if(Session.session != null && cam != null){
     Session.session.RegisterPlayer(this, player, cam);
       }
       else{ print("Session or cam is null"); }
       if(player == 1){ input = new ActorInputHandler(this, "KEYBOARD AND MOUSE"); }
       else{ input = new ActorInputHandler(this, "XBOX 360 CONTROLLER"); }
       StartCoroutine(InputRoutine());
     }
     else if(player == 5){
       if(defaultAI == ""){ ai = new AIManager(this, "PASSIVE"); }
       else{ ai = new AIManager(this, defaultAI); }
       if(speechTreeFile != ""){ speechTree = new SpeechTree(speechTreeFile); }
     }
 }