Ejemplo n.º 1
0
    public void DisplayCheck()
    {
        //if the building is on fire and there isn't a display
        if (onFire && infoDisplay == null)
        {
            infoDisplay = Instantiate(infoDisplayPrefab, transform.position, Quaternion.identity, transform);
            //infoDisplay.GetComponentInChildren<Button>().onClick.AddListener(CallFireEngine);
            EventManagerScript manager = GameObject.FindGameObjectWithTag("InteractionEvent").GetComponent <EventManagerScript>();

            Button button = infoDisplay.transform.GetComponentInChildren <Button>();
            Debug.Log(button);
            button.onClick.AddListener(manager.NextEvent);
            infoDisplay.GetComponent <TrackerUIScript>().LeaveHover();

            fire = Instantiate(fireParticlePrefab, gameObject.transform.position, Quaternion.Euler(-90, 0, 0));
        }

        //if the building is not on fire and there is a display
        if (!onFire && infoDisplay != null)
        {
            Destroy(infoDisplay);
            Destroy(fire);
            //make sure infoDisplay is cleared
            infoDisplay = null;
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     walker = GameObject.FindGameObjectWithTag("WalkHome").GetComponent<SideScrollWalkScript>();
     eventManager = GameObject.FindGameObjectWithTag ("EventManager").GetComponent<EventManagerScript>();
     textPos = transform.GetChild (0).transform.position;
     targetTextColor = Color.black;
     targetTextColor.a = 0f;
 }
Ejemplo n.º 3
0
 void Start()
 {
     eMS = FindObjectOfType <EventManagerScript>();
     if (buttonCanvas.isActiveAndEnabled)
     {
         buttonCanvas.gameObject.SetActive(false);
     }
     if (portraitCanvas.isActiveAndEnabled)
     {
         portraitCanvas.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        PathScript potentialPath = null;

        if (isLaunching)
        {
            UpdateLaunching();

            potentialPath = GetPotentiallyQualifiedPath(EventManagerScript.GetMouseInWorldPosition());

            if (potentialPath != null)
            {
                potentialPath.DisplayVisualHint(transform);
            }
        }

        if (this.potentialPath != null && this.potentialPath != potentialPath)
        {
            this.potentialPath.StopVisualHint();
        }

        this.potentialPath = potentialPath;
    }
Ejemplo n.º 5
0
    void Start()
    {
        // settings variables to reduce GetComponent calls
        trb      = gameObject.GetComponent <Rigidbody>();
        tt       = gameObject.GetComponent <Transform>();
        Controls = GameObject.Find("Controls").GetComponent <ControlsScript>();
        //load ressources
        GameObject.Find("Tribename").GetComponent <Text>().text = PlayerPrefs.GetString("Name");
        CampOn      = Resources.Load <Sprite>("Play/TribeChar/camp");
        CampOff     = Resources.Load <Sprite>("Play/TribeChar/camp_night");
        TribeSprite = gameObject.GetComponent <SpriteRenderer>();
        EMS         = GameObject.Find("EventManager").GetComponent <EventManagerScript>();

        // manual player add
        if (PlayerPrefs.GetString("Seed") != null)
        {
            if (PlayerPrefs.GetString("Seed") == "Seed hack")
            {
                AddChar(0, "Leader", "Play/Prefabs/Characters/Leader");
                AddChar(1, "Man1", "Play/Prefabs/Characters/Man1");
                AddChar(2, "Man2", "Play/Prefabs/Characters/Man2");
                AddChar(3, "Woman1", "Play/Prefabs/Characters/Woman1");
                AddChar(4, "Woman2", "Play/Prefabs/Characters/Woman2");
                AddChar(5, "Son", "Play/Prefabs/Characters/Son");
                AddChar(6, "Daughter", "Play/Prefabs/Characters/Daughter");
                AddChar(7, "Elder", "Play/Prefabs/Characters/Elder");
            }
        }
        foreach (GameObject chars in Characters)
        {
            if (chars.GetComponent <CharacterScript>().speed < TrbSpeed)
            {
                TrbSpeed = chars.GetComponent <CharacterScript>().speed;
            }
        }
    }
Ejemplo n.º 6
0
    void Start()
    {
        Cs = GameObject.Find("Controls").GetComponent <ControlsScript>();
        gameObject.GetComponent <Transform>().position = new Vector3(gameObject.GetComponent <Transform>().position.x, Cs.CharacterPlane, gameObject.GetComponent <Transform>().position.z);
        prb = gameObject.GetComponent <Rigidbody>();
        pt  = gameObject.GetComponent <Transform>();
        GameObject.Find("Tribename").GetComponent <Text>().text = PlayerPrefs.GetString("Name");
        tribe    = GameObject.Find("Tribe").GetComponent <TribeScript>();
        tribePos = tribe.GetComponent <Transform>();
        EMS      = GameObject.Find("EventManager").GetComponent <EventManagerScript>();
        if (age > 15)
        {
            tribe.TrbAdults++;
        }
        else
        {
            tribe.TrbYoungs++;
        }
        tribe.TrbUnity += moral;
        tribe.TrbRank  += exp;

        //add ? or ratio ? or more complex ? add for now.
        if (endu + speed + percept + social > 10)
        {
            //gatherer
            tribe.TrbGather.Add(gameObject);
            if (available == true)
            {
                EMS.Gatherers_Available.Add(this);
            }
            else
            {
                EMS.Gatherers_Unavailable.Add(this);
            }
        }
    }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     speechBubble = transform.parent.Find("SpeechBubble").gameObject;
     speechBubbleScript = speechBubble.GetComponent<SpeechBubbleGenerator>();
     rbody = GetComponent<Rigidbody>();
     environment = GameObject.FindGameObjectWithTag("Environment");
     eventManager = environment.GetComponent<EventManagerScript>();
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManagerScript>();
     sr = GetComponent<SpriteRenderer>();
     ParseLines ();
     textPos = transform.GetChild (0).transform.position;
     targetTextColor = Color.black;
     targetTextColor.a = 0f;
 }
    //AudioConversationScript acsManager = GameObject.FindGameObjectWithTag("AudioConversationManager").GetComponent<AudioConversationScript>();
    // Use this for initialization
    void Start()
    {
        /*currentConv = new Conversation();
        currentConv.currentText = "thisisawholelotofreallylongtextbuddyiknowitsgonnagotothenextlineisupertotallybetcha"; // Still greatest line of code in the game.
        currentConv.options = new string[5];
        currentConv.options[0] = "first";
        currentConv.options[1] = "secondy";
        currentConv.options[2] = "third";
        currentConv.options[3] = "fourth";
        currentConv.options[4] = "fifth";
        numResponses = 5;
        currentConv.currentInteractionType = "respond";
        minResponse = 0;
        maxResponse = 4;*/

        audioManager = GameObject.FindGameObjectWithTag ("AudioManager").GetComponent<AudioManagerScript>();;

        eventManager = GetComponent<EventManagerScript>();
        inventory = GetComponent<InventoryScript>();
        barter = GetComponent<BarterScript>();

        TextAsset[] files = Resources.LoadAll<TextAsset> ("Conversations");
        for(int i = 0; i < files.Length; i++){
            Conversation temp = ParseConversationFile(files[i]);
            if(temp.name != null){
                conversations[temp.name] = temp;
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
        eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManagerScript>();
        ArrayList temp = new ArrayList();
        for(int i = 0; i < transform.childCount; i++){
            if(transform.GetChild(i).GetComponent<PersonScript>().isFamily){
                temp.Add(transform.GetChild (i).gameObject);
            }
        }
        family = new PersonScript[temp.Count];
        for(int i = 0; i < temp.Count; i++){
            family[i] = ((GameObject)temp[i]).GetComponent<PersonScript>();
        }

        temp = new ArrayList();
        for(int i = 0; i < transform.childCount; i++){
            if(!transform.GetChild(i).GetComponent<PersonScript>().isFamily){
                temp.Add(transform.GetChild (i).gameObject);
            }
        }
        jews = new PersonScript[temp.Count];
        for(int i = 0; i < temp.Count; i++){
            jews[i] = ((GameObject)temp[i]).GetComponent<PersonScript>();
        }
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     fms = GameObject.FindGameObjectWithTag("FamilyManager").GetComponent<FamilyManagerScript>();
     eventManager = GetComponent<EventManagerScript>();
     input = GameObject.FindGameObjectWithTag("EventManager").GetComponent<InputManagerScript>();
     audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManagerScript>();
 }
Ejemplo n.º 12
0
 void OnMouseUp()
 {
     ExitLaunching(EventManagerScript.GetMouseInWorldPosition());
 }
 // Use this for initialization
 void Start()
 {
     transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
     eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManagerScript>();
     input = GameObject.Find ("EventManager").GetComponent<InputManagerScript>();
     inventory = GameObject.Find ("EventManager").GetComponent<InventoryScript>();
     currentPosition = start.GetComponent<ItemPositionScript>();
     positions = new ItemPositionScript[transform.childCount];
     for(int i = 0; i < transform.childCount; i++){
         positions[i] = transform.GetChild (i).GetComponent<ItemPositionScript>();
     }
 }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        fms = GameObject.FindGameObjectWithTag("FamilyManager").GetComponent<FamilyManagerScript>();
        eventManager = GetComponent<EventManagerScript>();
        numToBake = new int[bread.Length];

        /*for (int i = 0; i < allBreads.Length; i++) {	// Need a total list of the breads available for baking.
            GameObject go = (GameObject)Instantiate(allBreads[i]);
            go.transform.position = new Vector3(999f, 999f, 999f);
            breadList.Add (allBreads[i]);
        }*/
    }