//called before Start(), before the scene loads
	void Awake() {
		//persist between scenes
		Object.DontDestroyOnLoad (transform.gameObject);
		UpdateUI ();
		if (inst == null) {
			inst = this;
		} else {
			Destroy (this.gameObject);
		}
	}
Example #2
0
 // Gets the ObjectiveHandler component and sets the original color of the objective
 void Start()
 {
     objectiveHandler = handler.GetComponent<ObjectiveHandler>();
     spriteRenderer = GetComponent<SpriteRenderer>();
     if (lookingFor.tag == CharacterType.SmallCube.GetID()) {
         originalColor = new Color(spriteRenderer.color.r, spriteRenderer.color.g, spriteRenderer.color.b, 0.61960784313725490196078431372549f);
     } else if (lookingFor.tag == CharacterType.BigCube.GetID()) {
         originalColor = new Color(spriteRenderer.color.r, spriteRenderer.color.g, spriteRenderer.color.b, 0.70196078431372549019607843137255f);
     }
     lookingForTag = lookingFor.tag;
     lookingForType = CharacterTypeExtension.GetEnumFromID(lookingForTag);
 }
Example #3
0
 //called before Start(), before the scene loads
 void Awake()
 {
     //persist between scenes
     Object.DontDestroyOnLoad(transform.gameObject);
     UpdateUI();
     if (inst == null)
     {
         inst = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Example #4
0
 // Gets the ObjectiveHandler component and sets the original color of the objective
 void Start()
 {
     objectiveHandler = handler.GetComponent <ObjectiveHandler>();
     spriteRenderer   = GetComponent <SpriteRenderer>();
     if (lookingFor.tag == CharacterType.SmallCube.GetID())
     {
         originalColor = new Color(spriteRenderer.color.r, spriteRenderer.color.g, spriteRenderer.color.b, 0.61960784313725490196078431372549f);
     }
     else if (lookingFor.tag == CharacterType.BigCube.GetID())
     {
         originalColor = new Color(spriteRenderer.color.r, spriteRenderer.color.g, spriteRenderer.color.b, 0.70196078431372549019607843137255f);
     }
     lookingForTag  = lookingFor.tag;
     lookingForType = CharacterTypeExtension.GetEnumFromID(lookingForTag);
 }
 void Start()
 {
     oh = objcHandlerObj.GetComponent<ObjectiveHandler> ();
     pv = player.GetComponent<PlayerVolume> ();
     sQstring = startQuestText.text;
     fQstring = finishQuestText.text;
     char[] delimitingChars = {'\n'};
     sQLines = sQstring.Split (delimitingChars);
     fQLines = fQstring.Split (delimitingChars);
     ch = chatHandlerObject.GetComponent<ChatHandler> ();
     npcb = this.GetComponent<NPCBehaviour> ();
     objectContainer = questObjectContainer.transform;
     questStarted = false;
     questFinished = false;
     r = new Reward (0, levelReward);
     q = new Quest (this.gameObject, r, quest_name, quest_description);
 }
Example #6
0
    void UpdateObjectiveList()
    {
        ObjectiveHandler oh = ObjectiveHandler.Current;

        if (oh == null)
        {
            objectiveList.gameObject.SetActive(false);
            return;
        }

        string list = "";

        bool activeObjectives = false; // Used to check if there are any active objectives to display

        foreach (PlayerObjective o in oh.objectives)
        {
            if (o.state == ObjectiveState.Active)
            {
                activeObjectives = true;

                if (o.mandatory == false)
                {
                    list += "OPTIONAL: ";
                }

                list += o.DisplayCriteria();

                list += "\n";
            }
        }

        if (activeObjectives == false) // If there are no active objectives, list an alternate message
        {
            list += "All completed";
        }

        objectiveList.gameObject.SetActive(true);
        objectiveList.text = list;
    }
    /// <summary>
    /// If Guest is touched during checking in then the rooms wil be highlighted and the guest will be selected.
    /// If Guest is touched uring checking out then the guest will be checked out, money will be added by the moneyhandler and objectivehandler and the selectedGuest will be set to null.
    /// </summary>
    /// <param name="collider">Collider of touched GameObject.</param>
    /// <param name="moneyHandler">Reference to the moneyHandler.</param>
    /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
    /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
    /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
    public override void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop)
    {
        Guest guest = collider.GetComponent <Guest>();

        if (guest.checkIn)
        {
            selectedGuest = guest;
            selectedGuest.navigator.HighlightRooms(true);
            return;
        }
        else if (guest.checkOut)
        {
            moneyHandler.CheckOut();
            objectiveHandler.AddObjectiveAmount(1, ObjectiveType.Keys);
            guest.checkOut = false;
            guest.CheckOut();
            selectedGuest = null;
            return;
        }
    }
Example #8
0
	// Use this for initialization
	void Start () {
		handler = GameObject.FindGameObjectWithTag ("UI").GetComponent<ObjectiveHandler> ();
		grab = GameObject.FindGameObjectWithTag ("Player").GetComponentInChildren<GrabController> ();
	}
    /*
     * // Start is called before the first frame update
     * void Start()
     * {
     *
     * }
     */

    private void Awake()
    {
        ph = GetComponent <PlayerHealth>();
        wh = GetComponent <WeaponHandler>();
        oh = GetComponent <ObjectiveHandler>();
    }
    /// <summary>
    /// If Room is touched while a guest is selected and the room is available then the guest will be sent to the room and will be checked in.
    /// Else if the Bellhop is not null and the room should be cleaned then the room wil not be available to guests and the bellhop is sent over to clean it.
    /// Selected guest is always set to null if one was selected.
    /// </summary>
    /// <param name="collider">Collider of touched GameObject.</param>
    /// <param name="moneyHandler">Reference to the moneyHandler.</param>
    /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
    /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
    /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
    public override void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop)
    {
        Room            room     = collider.GetComponent <Room>();
        NavigationPoint navPoint = room.navigationPoint;

        if (selectedGuest & room.availableToGuests)
        {
            List <Vector2> route = selectedGuest.GetRoute(selectedGuest.currentPosition, navPoint);
            if (route != null)
            {
                selectedGuest.navigator.HighlightRooms(false);
                selectedGuest.SetRoute(route, room);
                selectedGuest.checkIn = false;
                selectedGuest.CheckIn();
                moneyHandler.CheckIn();
                room.DoorState(false);
            }
        }
        else if (bellhop)
        {
            if (room.shouldClean)
            {
                room.availableToGuests = false;
                bellhop.AddInteractionToQueue(room);
            }
        }

        if (selectedGuest)
        {
            selectedGuest.navigator.HighlightRooms(false);
            selectedGuest = null;
        }
    }
    void Start()
    {
        startCheckChat = false;

        spawner = spawnerObj.GetComponent<Spawner> ();
        oh = objcHandlerObj.GetComponent<ObjectiveHandler> ();
        sQstring = startQuestText.text;
        fAQstring = failedQuestText.text;
        fQstring = finishQuestText.text;
        char[] delimitingChars = {'\n'};
        sQLines = sQstring.Split (delimitingChars);
        fQLines = fQstring.Split (delimitingChars);
        fAQLines = fAQstring.Split (delimitingChars);
        ch = chatHandlerObj.GetComponent<ChatHandler> ();
        npcb = this.GetComponent<NPCBehaviour> ();
        rewardHandler = rewardParent.GetComponent<DestructiblesHandler> ();
        questStarted = false;
        questFinished = false;

        r = new Reward (0, rewardLevels);
        q = new Quest (this.gameObject, r, quest_name, quest_description);
    }
Example #12
0
 /// <summary>
 /// Interaction method when touching something.
 /// </summary>
 /// <param name="collider">Collider of touched GameObject.</param>
 /// <param name="moneyHandler">Reference to the moneyHandler.</param>
 /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
 /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
 /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
 public abstract void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop);
Example #13
0
    /*
     * // Start is called before the first frame update
     * void Start()
     * {
     *  gameObject.SetActive(false);
     * }
     *
     * // Update is called once per frame
     * void Update()
     * {
     *
     * }
     */
    public void GenerateScreen(ObjectiveHandler oh)
    {
        #region Update optional objective list
        string message            = "Optional objectives completed:";
        int    remaining          = 0;
        bool   optionalObjectives = false;

        foreach (PlayerObjective o in oh.objectives)
        {
            if (o.mandatory == false)
            {
                optionalObjectives = true;
                if (o.state == ObjectiveState.Completed)
                {
                    message += "\n";
                    message += o.name;
                }
                else
                {
                    remaining += 1;
                }
            }
        }

        if (optionalObjectives == true)
        {
            message += "\n";
            if (remaining > 0)
            {
                message += remaining;

                if (remaining > 1)
                {
                    message += " objectives";
                }
                else
                {
                    message += " objective";
                }

                message += " remaining";
            }
            else
            {
                message += "All completed";
            }
        }
        else
        {
            message = "No optional objectives";
        }

        remainingOptionalObjectives.text = message;
        #endregion

        if (oh.nextLevelName == "")
        {
            nextLevelButton.interactable = false;
        }
        else
        {
            nextLevelButton.onClick.AddListener(() => GetComponent <MenuHandler>().LoadScene(oh.nextLevelName));
        }
    }
    /// <summary>
    /// Bellhop gets the supply NavigationInteraction added to it's queue.
    /// Selected guest is set to null and rooms highlights will disappear.
    /// </summary>
    /// <param name="collider">Collider of touched GameObject.</param>
    /// <param name="moneyHandler">Reference to the moneyHandler.</param>
    /// <param name="objectiveHandler">Reference to the objectiveHandler.</param>
    /// <param name="selectedGuest">Actual Reference to the selectedGuest in the TouchInput Script.</param>
    /// <param name="bellhop">Actual Reference to the bellhop in the TouchInput Script.</param>
    public override void TouchInteract(Collider2D collider, MoneyHandler moneyHandler, ObjectiveHandler objectiveHandler, ref Guest selectedGuest, ref Bellhop bellhop)
    {
        if (bellhop)
        {
            NavigationInteraction supply = collider.GetComponent <NavigationInteraction>();
            bellhop.AddInteractionToQueue(supply);

            if (selectedGuest)
            {
                selectedGuest.navigator.HighlightRooms(false);
                selectedGuest = null;
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     dc = dcObject.GetComponent<DestroyControls> ();
     oh = objectivesObj.GetComponent<ObjectiveHandler> ();
     whichTarget = 0;
     targetCount = viewObject.transform.childCount;
     startAni = false;
     finished = false;
     targetLocations = new Vector3[viewObject.transform.childCount + 1];
     targetRotations = new Vector3[viewObject.transform.childCount + 1];
     int index = 0;
     foreach (Transform child in viewObject.transform) {
         targetLocations[index] = child.position;
         targetRotations[index] = child.localRotation.eulerAngles;
         index++;
     }
     if (!canPlayAnimation) {
         finished = true;
     }
 }
 void Start()
 {
     db = this.GetComponent<DestructibleBehaviour> ();
     peh = primaryEventObj.GetComponent<PrimaryEventHandler> ();
     oh = objcHandlerObj.GetComponent<ObjectiveHandler> ();
 }
 // Awake.
 private void Awake()
 {
     Instance = this;
 }