Esempio n. 1
0
 public void recieveAction()
 {
     MetaScript.preTeleport();
     MetaScript.getPlayer().GetComponent <DynamicGeneration>().enabled = false;
     MetaScript.getPlayer().transform.position = new Vector3(entranceXPos, DEPTH, entranceZPos);
     MetaScript.getPlayer().GetComponent <InBuilding>().setPlayerInBuilding(true);
     MetaScript.postTeleport();
 }
Esempio n. 2
0
    public void recieveAction()
    {
        if (!this.enabled)
        {
            return;
        }


        MetaScript.preTeleport();
        player.GetComponent <DynamicGeneration>().enabled = false;
        MetaScript.GetInBuilding().setPlayerInBuilding(true);
        player.transform.position = new Vector3(bg.getdoorxlocation() + bg.getxlocation(), bg.getylocation(), bg.getdoorzlocation() + bg.getzlocation());
        MetaScript.postTeleport();

        player.GetComponent <InBuilding>().setPlayerInBuilding(true);
        disableParticleSystems();
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (controls.keyDown(controls.TownPortal))
        {
            bool inBuilding = false;
            if (buildingCheck != null)
            {
                inBuilding = buildingCheck.getPlayerInBuilding();
            }

            if (MetaScript.getRes().hasResource(costType, resourceCost) && !inBuilding)
            {
                MetaScript.getRes().addResource(costType, -resourceCost);
                MetaScript.preTeleport();
                transform.parent.transform.position = MetaScript.getTownCenter().transform.position + new Vector3(0.5f, 0, -0.5f);
                MetaScript.postTeleport();
                MetaScript.Poof(MetaScript.getPlayer().transform.position);
            }
        }
    }
Esempio n. 4
0
    IEnumerator PerformRitual()
    {
        GameObject sacrifice = MetaScript.GetSacrificialNPC();

        // Disable and heal player
        setPlayerBusy(true);
        health = maxHealth;

        // Sacrifice failed
        if (sacrifice == null)
        {
            // Load other scene
            Destroy(gameObject);
            gameEnds();
        }
        else
        {
            // Stop npc from moving;
            sacrifice.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false;
            sacrifice.GetComponent <collect>().enabled = false;
            sacrifice.GetComponent <Guard>().enabled   = false;
            sacrifice.GetComponent <follow>().enabled  = false;

            // Teleport player;
            MetaScript.preTeleport();
            sacrifice.transform.eulerAngles = new Vector3(45, 0, 90);
            transform.position           = sacrifice.transform.position;
            sacrifice.transform.position = sacrifice.transform.position + new Vector3(0.25f, 0, 0);

            // TODO: Delay spawn
            // Destroy npc
            yield return(new WaitForSeconds(2.0f));

            sacrifice.GetComponent <Health>().death();
            MetaScript.postTeleport();


            setPlayerBusy(false);
        }
        yield return(null);
    }
Esempio n. 5
0
    public void recieveAction()
    {
        // }else{
        //     player.GetComponent<DynamicGeneration>().enabled = true;
        // }
        // if(pos != null)
        // {
            print(pos.x + "" + pos.y + "" + pos.z);
            MetaScript.preTeleport();
            player.transform.position = pos;
            MetaScript.postTeleport();

        player.GetComponent<DynamicGeneration>().enabled = true;
        player.GetComponent<InBuilding>().setPlayerInBuilding(false);
        //gameObject.GetComponent<ParticleSystem>().emission.enabled = true;
            //print(xpos + zpos);
        // }
        // else
        // {

        //     Debug.Log("The return building has not been set yet");
        // }
    }