Exemplo n.º 1
0
 void Awake()
 {
     if (npc == null)
     {
         npc = this;
     }
     else if (npc != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
    public void Infect()
    {
        // return if game is paused
        if (GameData.instance.isPaused)
        {
            return;
        }

        if (status == Status.healthy)
        {
            status = Status.infected;

            npcController npc = GetComponent <npcController>();
            if (npc != null)
            {
                npc.BecomeInfected();
            }
        }
    }
Exemplo n.º 3
0
    IEnumerator restoretownstate()
    {
        questCompleted();
        ScreenFader sf = GameObject.FindGameObjectWithTag("Fader").GetComponent <ScreenFader>();


        yield return(StartCoroutine(sf.FadeToBlack()));

        theCompanion.gameObject.SetActive(true);
        theCompanion.transform.position = cposition.position;
        theCompanion.canMove            = false;
        theCompanion.incutscene         = true;
        theCompanion.moveDirection.y    = 1;
        npcController npCont = GameObject.FindObjectOfType <npcController>().GetComponent <npcController>();

        npCont.set1State(true);
        npCont.set2State(false);
        zCont.zone1State(false);
        zCont.battleOn(false);
        theTrader.transform.position = tposition.position;
        mc.switchTrack(1);
        yield return(StartCoroutine(sf.FadeToClear()));
    }
Exemplo n.º 4
0
 void Start()
 {
     npc        = GetComponent <npcController>();
     germParent = GameObject.Find("GermPool").GetComponent <Transform>();
 }
Exemplo n.º 5
0
 void Start()
 {
     npc = GetComponent <npcController>();
 }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (mc == null)
        {
            mc = FindObjectOfType <musicController>();
        }

        if (xpm == null)
        {
            xpm = FindObjectOfType <experienceManager>();
        }
        if (questIndex == 2)
        {
            if (bananaCount == 5)
            {
                questCompleted();
            }
        }

        if (questIndex == 5)
        {
            if (wolfcount == 3)
            {
                npcController npCont = GameObject.FindObjectOfType <npcController>().GetComponent <npcController>();
                npCont.set1State(false);
                npCont.set2State(true);

                zCont.zone1State(true);
                wolfcount = 0;
                questCompleted();
            }
        }
        if (questIndex == 7)
        {
            if (wolfcount == piratemax)
            {
                Debug.Log("in");
                for (int x = 0; x < piratesc.Length; x++)
                {
                    piratesc[x].canMove = false;
                }
                dMan.textLines = lines;
                dMan.textimage = img;
                dMan.textName  = charac;
                dMan.img       = img;
                dMan.images    = images;

                if (!dMan.dialogActive && !istriggered)
                {
                    dMan.showDialogue();
                    dMan.currentLine = 0;
                    istriggered      = true;
                    wolfcount        = 0;
                }
            }
            if (!dMan.dialogActive && istriggered)
            {
                StartCoroutine("restoretownstate");
            }
        }
    }
Exemplo n.º 7
0
    void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "townNPC")
        {
            if (actionButton)
            {
                isTalking = true;
                other.gameObject.GetComponent <npcController>().talk();
                cameraController.isControllable = false;
            }

            if (cancelButton)
            {
                other.gameObject.GetComponent <npcController>().silence();
                cameraController.isControllable = true;
            }
        }

        if (other.gameObject.tag == "shopNPC")
        {
            npcController npc = other.gameObject.GetComponent <npcController>();
            if (actionButton)
            {
                if (!isTalking)
                {
                    isTalking = true;
                    //				shopMenu.shopItemList = npc.shopItems;
                    npc.openShop();
                    cameraController.isControllable = false;
                }
                else
                {
                    shopMenu.closeMenu();
                }
            }

            if (cancelButton)
            {
                if (shopMenu.subMenuOpen)
                {
                    shopMenu.closeMenu();
                }
                else if (shopMenu.selectMenu.activeInHierarchy)
                {
                    shopMenu.exit();
                    npc.closeShop();
                }
                else
                {
                    npc.silence();
                    cameraController.isControllable = true;
                }
            }
        }

        if (other.gameObject.tag == "questNPC")
        {
            if (actionButton)
            {
                isTalking = true;
                other.gameObject.GetComponent <npcController>().talk();
                cameraController.isControllable = false;
            }

            if (cancelButton)
            {
                other.gameObject.GetComponent <npcController>().silence();
                cameraController.isControllable = true;
            }
        }

        if (other.tag == "Enemy" && actionButton)
        {
            gameController.startBattle(other.gameObject);
        }
    }