Exemple #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         _go          = other.gameObject;
         _playerSpeed = _go.GetComponent <PlayerController>().Speed;
         Flowchart.SendFungusMessage("playerThere");
     }
 }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown("1"))
     {
         flowchart.SendFungusMessage("Save");
     }
     if (Input.GetKeyDown("2"))
     {
         flowchart.SendFungusMessage("Load");
     }
 }
Exemple #3
0
    public void dead()
    {
        moveL  = false;
        moveLB = false;
        moveR  = false;
        moveRB = false;

        //flowchart.SetBooleanVariable("chatOn", true);
        flowchart.SendFungusMessage("dead");
        x++;
        Destroy(gameObject);
    }
Exemple #4
0
//for collision enter actions. COuld be useful in future.
//	void OnCollisionEnter(Collision collision){
//		print ("collided");
//
//	}

    //When player enters the trigger box, send the flowchartMessage to the target flowchart.
    void OnTriggerEnter2D(Collider2D other)
    {
        _firstTimeList.Add(true);

        int finalMessageIndex = 0;      //message to send based on the items

        //if the NPC has multiple dialogue scenes, the dialogue scenes are based on what the
        //character is carrying.
        if (needededItems != null)
        {
            foreach (string item in needededItems)
            {
                //if item is in the game manager's player inventory, add it to the message
                if (POCC.GameManager.getInstance().playerHasItem(item))
                {
                    finalMessageIndex += 1;
                }
            }
        }

        //intialize the first-time flag list
        for (int i = 0; i < needededItems.Count; i++)
        {
            _firstTimeList.Add(true);
        }

        if (targetFlowchart != null && other.tag == "Player" && _firstTimeList[finalMessageIndex])
        {
            targetFlowchart.SendFungusMessage("" + finalMessageIndex);
            _firstTimeList [finalMessageIndex] = false;            //set the first time to false after first time interacted
        }
    }
Exemple #5
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Player")
     {
         cameraDev.SendFungusMessage("interact");
     }
 }
Exemple #6
0
 public override void OnStateChanged(GameState newState, GameState oldState)
 {
     if (newState.AnnanaHouse.IsInside && (oldState == null || !oldState.AnnanaHouse.IsInside))
     {
         // Full animation while playing the game
         if (oldState != null)
         {
             Flowchart.SendFungusMessage("GoIn");
         }
         // Load saved game state
         else // oldState == null
         {
             Flowchart.SendFungusMessage("GoInSwitch");
         }
     }
     if (newState.AnnanaHouse.IsOutside && (oldState == null || !oldState.AnnanaHouse.IsOutside))
     {
         // Full animation while playing the game
         if (oldState != null)
         {
             Flowchart.SendFungusMessage("GoOut");
         }
         // Load saved game state
         else // oldState == null
         {
             Flowchart.SendFungusMessage("GoOutSwitch");
         }
     }
 }
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (Input.GetKey(KeyCode.Q))
     {
         dialog.SendFungusMessage("click");
     }
 }
Exemple #8
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Player")
     {
         collect.SendFungusMessage("talk");
         dev.SendFungusMessage("talk");
     }
 }
Exemple #9
0
 public void Activate(Transform player)
 {
     l?.InteractLever();
     c?.ActivateCandle();
     t?.Interact(player);
     f?.SendFungusMessage("hello");
     w?.InteractLever();
 }
Exemple #10
0
 void DialogueCounter()
 {
     flowchart.SendFungusMessage(eventTalk.Messages[eventTalk.Counter]);
     if (eventTalk.Counter < eventTalk.Messages.Count - 1)
     {
         eventTalk.Counter++;
     }
 }
Exemple #11
0
 //Envía un mensaje a Fungus (como el nodo SendMessage) para que podamos capturarlo nosotros capturando ese mensaje en concreto.
 public void activaFungus(string mensaje)
 {
     Debug.Log("Entro al activador de Fungus");
     if (flowchart.gameObject.activeInHierarchy)
     {
         flowchart.SendFungusMessage(mensaje);
     }
 }
    private IEnumerator StartFrontPage()
    {
        yield return(null);

        pageListObj.SetActive(true);
        yield return(null);

        bookFlowchart.SendFungusMessage(FRONT_PAGE_NAME);
    }
Exemple #13
0
    public override void OnStateChanged(GameState newState, GameState oldState)
    {
        // We just came to ritual site
        if (newState.HubaForest.IsOnSite && (oldState == null || !oldState.HubaForest.IsOnSite))
        {
            string mssg = oldState == null ? "GoSiteSwitch" : "GoSite";
            Debug.Log(mssg);
            Flowchart.SendFungusMessage(mssg);
        }
        // Regular forest
        else if ((newState.HubaForest.IsInForest && (oldState == null || !oldState.HubaForest.IsInForest)) ||                   // Player just came to forest
                 (oldState != null && oldState.HubaForest.CurrentForestWay.Count < newState.HubaForest.CurrentForestWay.Count)) // Player went further to the forest
        {
            ToggleGlow(newState.HubaForest.IsHubaBlessed);

            string mssg = oldState == null ? "GoForestSwitch" : "GoForest";
            Flowchart.SendFungusMessage(mssg);
        }
        // Annana killed the turtle
        else if (newState.AnnanaTeaParty.ThrewCup)
        {
            Flowchart.SendFungusMessage("WrongStart");
            Bus.GetComponent <SkeletonAnimation>().AnimationState.SetAnimation(0, "killed", false);
            Mug.SetActive(true);
            InvButton.SetActive(false);
        }
        // First time coming to scene
        else if (newState.HubaBus.getOnTheBus && !newState.HubaForest.IsSceneStarted)
        {
            // Set bus in front of Huba
            Bus.GetComponent <SkeletonAnimation>().AnimationState.SetAnimation(0, "walk", true);
            Bus.GetComponent <MeshRenderer>().sortingLayerName = "Character";
            Bus.GetComponent <MeshRenderer>().sortingOrder     = 15;
            Flowchart.SendFungusMessage("GoStart");
            StateManager.Instance.DispatchAction(new SpringAction(ActionType.START_FOREST_SCENE));
        }
        // Huba cannot be here if she did not take the bus
        else if (!newState.HubaBus.getOnTheBus)
        {
            // Following is pretty ugly but works
            Huba.SetActive(false);

            // Disable all interactivity
            var cols = Resources.FindObjectsOfTypeAll <Collider2D>();
            foreach (var c in cols)
            {
                c.enabled = false;
            }

            // We still need camera manager for some reason
            CameraManager.Instance.gameObject.GetComponentInChildren <Collider2D>().enabled = true;

            // No character -> no inventory
            InvButton.SetActive(false);
        }
    }
Exemple #14
0
 public override void OnStateChanged(GameState newState, GameState oldState)
 {
     // We just came to ritual site
     if (newState.HubaBus.isInTheBus && (oldState == null || !oldState.HubaBus.isInTheBus))
     {
         string mssg = oldState == null ? "GoBusSwitch" : "GoBus";
         Debug.Log(mssg);
         Flowchart.SendFungusMessage(mssg);
     }
 }
Exemple #15
0
 public void ActiveFlowchart()
 {
     if (control != null)
     {
         _audio.Play();
         control.SendFungusMessage(_message);
         isUseful = false;
         UI.HideMessage();
     }
 }
Exemple #16
0
    private void OnMouseDown()
    {
        var target = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        target.z = 0f;
        var v = flowchart.GetVariable <VariableBase <Vector3> >("jellyTarget");

        v.Value = target;
        flowchart.SendFungusMessage(clickMessage);
    }
Exemple #17
0
    private void OnTriggerStay(Collider other)
    {
        //Debug.Log("觸發到的物件:" + other.name);

        if (other.name == "村民")
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                //Debug.Log("觸發對話!!!");

                switch (npcState)
                {
                case NPCState.鐵塊:
                    npc.SendFungusMessage("鐵塊");
                    //npcState = NPCState.鐵塊不足;
                    break;

                case NPCState.鐵塊不足:
                    npc.SendFungusMessage("鐵塊不足");
                    break;

                case NPCState.給予鑰匙:
                    npc.SendFungusMessage("給予鑰匙");
                    break;

                case NPCState.打敗魔王:
                    npc.SendFungusMessage("打敗魔王");
                    break;
                }
            }
        }

        if (other.tag == "鐵礦")
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                //Destroy(other.gameObject);
                obj = other.gameObject;                     // 物件 = 觸碰.遊戲物件
                Invoke("DelayDestroyMetal", 1);             // 延遲一秒呼叫方法:DelayDestroyMetal
            }
        }
    }
Exemple #18
0
 public void StartStory()
 {
     heroiNome      = nameInput.text;
     isFirstGameRun = false;
     SetNameToFlowChart();
     SetMozaoNameToFlowChart(MozaoName.text);
     SetSexHeroiToFlowChart();
     SetSexMozaoToFlowChart();
     UIChooseSex.SetActive(false);
     flowchart.SendFungusMessage("INTRO");
 }
Exemple #19
0
 //This void
 private void OnTriggerStay(Collider cl_trigger)
 {
     if (cl_trigger.gameObject.tag == "Player")
     {
         if (bl_requiresInput == false)
         {
             fc_NPCDialog.gameObject.SetActive(true);
             fc_NPCDialog.SendFungusMessage(st_MessageReciever);
             cc_PlayerController.enabled = true;
             //cs_FPSControl.lockCursor = false;
         }
         else if (Input.GetKeyDown(KeyCode.E))
         {
             fc_NPCDialog.gameObject.SetActive(true);
             fc_NPCDialog.SendFungusMessage(st_MessageReciever);
             cc_PlayerController.enabled = false;
             //cs_FPSControl.lockCursor = false;
         }
     }
 }
Exemple #20
0
    private void prepareFungusForConverstion(NpcController npc)
    {
        Customer info = npc.customerInfo;

        dialogFlowchart.SetStringVariable("openingLine", info.openingLine);
        dialogFlowchart.SetStringVariable("request", info.request);
        dialogFlowchart.SetBooleanVariable("ignoresYou", info.ignoresYou);
        dialogFlowchart.SetStringVariable("description", info.description);
        dialogFlowchart.SetStringVariable("exitLine", ExitLines.lines[Random.Range(0, ExitLines.lines.Length)]);
        dialogFlowchart.SendFungusMessage("initiateConversation");
    }
    public void Tutorial()
    {
        tutorialPlay = PlayerPrefs.GetInt("FirstPlay") == 0;
        try
        {
            flow.SetBooleanVariable("Multiplayer", MultiplayerManagement.multiplayer);
            flow.SetGameObjectVariable("Bullet", MultiplayerManagement.player1Active.bullet);
        } catch (NullReferenceException ex) {}

        if (tutorialPlay)
        {
            flow.gameObject.SetActive(true);
            flow.SendFungusMessage("Tutorial");
        }
        else
        {
            flow.gameObject.SetActive(true);
            flow.SendFungusMessage("SkipTutorial");
        }
    }
Exemple #22
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         speed = 0;
         flowy.SendFungusMessage("stop");
     }
     else
     {
         speed = 2;
     }
 }
Exemple #23
0
    IEnumerator Talk()
    {
        if (isTalking)
        {
            yield break;
        }
        isTalking = true;
        flowChart.SendFungusMessage(message);
        yield return(new WaitUntil(() => flowChart.GetExecutingBlocks().Count == 0));

        isTalking = false;
    }
Exemple #24
0
 void OnMouseDown()
 {
     if (!string.IsNullOrEmpty(onMouseDownMessage))
     {
         flowchart.SendFungusMessage(onMouseDownMessage);
     }
 }
Exemple #25
0
    // Update is called once per frame
    void Update()
    {
        if (playerIn)
        {
            nav.SetDestination(zone.position);
            flowchart.SendFungusMessage("FollowBird");
        }

        else
        {
            nav.SetDestination(player.transform.position);
        }
    }
Exemple #26
0
 void hit()
 {
     if (HP > 0)
     {
         aud.PlayOneShot(hitFX);
         HP--;
         hpList[HP].SetActive(false);
     }
     else
     {
         isDead = true;
         flowchart.SendFungusMessage("Character_dead");
     }
 }
Exemple #27
0
        private IEnumerator Awaken()
        {
            eyes[0].gameObject.SetActive(false);
            eyes[1].gameObject.SetActive(true);
            yield return(new WaitForSeconds(5));

            eyes[1].gameObject.SetActive(false);
            eyes[2].gameObject.SetActive(true);
            yield return(new WaitForSeconds(1.5f));

            eyes[2].gameObject.SetActive(false);
            yield return(new WaitForSeconds(0.5f));

            flowchart.SendFungusMessage("1");
        }
        private void BroadcastToFungus(string message, Flowchart flowchart = null)
        {
            string fullMessage = (prefixForAllMessages + message).TrimEnd();

            if (flowchart == null)
            {
                Debug.Log("Message to all flowcharts: «" + fullMessage + "»");
                Flowchart.BroadcastFungusMessage(fullMessage);
            }
            else
            {
                Debug.Log("Message to flowchart " + flowchart.name + ": «" + fullMessage + "»");
                flowchart.SendFungusMessage(fullMessage);
            }
        }
Exemple #29
0
    public override void OnStateChanged(GameState newState, GameState oldState)
    {
        if (oldState == null)
        {
            // We cannot change into something we already wear
            Actions.Remove(ActionMap[newState.AnnanaHouse.AnnanaDress]);
        }
        else if (oldState.AnnanaHouse.AnnanaDress != newState.AnnanaHouse.AnnanaDress)
        {
            // We cannot change into something we already wear
            Actions.Add(ActionMap[oldState.AnnanaHouse.AnnanaDress]);
            Actions.Remove(ActionMap[newState.AnnanaHouse.AnnanaDress]);

            Fungus.SendFungusMessage("ChangeClothes");
        }
    }
 //This void
 private void OnTriggerStay2D(Collider2D cl_trigger)
 {
     if (cl_trigger.gameObject.tag == "Player")
     {
         if (Input.GetKeyDown(KeyCode.E) && bl_Toggle == false)
         {
             fc_NPCDialog.gameObject.SetActive(true);
             fc_NPCDialog.SendFungusMessage(st_MessageReciever);
             rb_player.isKinematic = true;
             bl_Toggle             = true;
         }
         else if (Input.GetKeyDown(KeyCode.E) && bl_Toggle == true)
         {
             rb_player.isKinematic = false;
             fc_NPCDialog.gameObject.SetActive(false);
             bl_Toggle = false;
         }
     }
 }