Ejemplo n.º 1
0
 // If a TimeOfDayManager fails to claim an item as something for it to control, the item itself can find a TimeOfDayManager and tell it to control it, this is expensive at the moment as each time this happens it requests the TimeOfDayManager seek all scene objects, so is used in emergency only
 public void AmIadded(ObjectProperties objectProperties)
 {
     //if (props != null)
     if (!props.Contains(objectProperties) && !suns.Contains(objectProperties) && !instantUpdate.Contains(objectProperties)) {
         // TODO move to event system or send message or observables etc
         Debug.LogWarning(objectProperties.gameObject.name + " was not added so finding all ObjectProperties, bad for performance!", objectProperties.gameObject);
         SeekItems();
     }
 }
    public void setValuesFromProperties(ObjectProperties newProp, Transform newTarget)
    {
        this.customCamera = newProp.customCamera;
        this.transitionTime = newProp.transitionTime;

        float offsetHorizontal = 0.0f;
        float offsetVertical = 0.0f;
        if (newTarget.parent) {
            offsetHorizontal = newTarget.parent.eulerAngles.y;
            offsetVertical = newTarget.parent.eulerAngles.x;
        }
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        objectPropertiesScript1 = object1.GetComponent<ObjectProperties>();
        //objectPropertiesScript2 = object2.GetComponent<ObjectProperties>();

        //objects.Add(object2);

        //if (object3 != null)
        //{
        //    objects.Add(object3);
        //}

        objectScripts.Add(object2.GetComponent<ObjectProperties>());
        //objectScripts.Add(object3.GetComponent<ObjectProperties>());

        if (object3 != null)
        {
            objectScripts.Add(object3.GetComponent<ObjectProperties>());
        }
    }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     properties = GetComponent(typeof(ObjectProperties)) as ObjectProperties;
     timeSinceMove = 1;
 }
Ejemplo n.º 5
0
        public static LabelProperties setLabelPosition(ObjectProperties obj, LabelProperties lp, int i)
        {
            switch (obj.direction)
            {
                case direction.down:
                    lp.top += i * obj.itemSize;
                    break;
                case direction.left:
                    lp.left -= i * obj.itemSize;
                    break;
                case direction.right:
                    lp.left += i * obj.itemSize;
                    break;
                case direction.up:
                    lp.top -= i * obj.itemSize;
                    break;
            }

            return lp;
        }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     // set the script objects
     objectPropertiesScript = this.GetComponent<ObjectProperties>();
     iconHandlerScript = GameObject.Find("IconHandler").GetComponent<IconHandler>();
 }
Ejemplo n.º 7
0
 public void AddToFollowers(ObjectProperties item)
 {
     if (followers == null) followers = new List<ObjectProperties>();
     if (!followers.Contains(item)) followers.Add(item);
 }
Ejemplo n.º 8
0
			public void Read(BlamLib.IO.EndianReader s)
			{
				Valid = s.ReadInt32() > 0;
				Header.Read(s);
				Version = s.ReadInt16();
				NumberOfScenarioObjects = s.ReadInt16();
				NumberOfVariantObjects = s.ReadInt16();
				NumberOfPlaceableObjectQuotas = s.ReadInt16();
				MapId = s.ReadInt32();
				WorldBoundsXMin = s.ReadSingle(); WorldBoundsXMax = s.ReadSingle();
				WorldBoundsYMin = s.ReadSingle(); WorldBoundsYMax = s.ReadSingle();
				WorldBoundsZMin = s.ReadSingle(); WorldBoundsZMax = s.ReadSingle();
				GameEngineSubtype = s.ReadInt32();
				BudgetTotal = s.ReadSingle();
				BudgetUsed = s.ReadSingle();
				Unknown5 = s.ReadUInt32(); Unknown6 = s.ReadUInt32();
				for (int x = 0; x < Properties.Length; x++) (Properties[x] = new ObjectProperties()).Read(s);
				for (int x = 0; x < ObjectTypeMap.Length; x++) ObjectTypeMap[x] = s.ReadInt16();
				for (int x = 0; x < Quotas.Length; x++) (Quotas[x] = new ObjectQuotas()).Read(s);
			}
Ejemplo n.º 9
0
    // if the icon is clicked on
    void OnMouseOver()
    {
        // if the icon is left clicked
        if (Input.GetMouseButtonDown(0))
        {
            objectPropertiesScript = linkedObject.GetComponent<ObjectProperties>();

            // if icon is look
            if (iconType == 0)
            {
                // output text description stored on object

                // if object has a description field with a string in it
                if(!String.Equals(objectPropertiesScript.description, ""))
                {
                    // set the starting time for the text
                    clickedTime = Time.time;

                    objectText = objectPropertiesScript.description;
                }
            }

            // if icon is use
            else if (iconType == 1)
            {
                // carry out the proper action based ont he object's properties

                // if the use type is 1, AKA swap
                // swap the visibility from on to off or vice versa
                if(objectPropertiesScript.useType == 1)
                {
                    SwapScript swapScript = linkedObject.GetComponent<SwapScript>();

                    swapScript.firstClicked = true;

                    //if (swapScript.status == true)
                    //{
                    //    swapScript.status = false;
                    //}
                    //else
                    //{
                    //    swapScript.status = true;
                    //}

                    iconHandlerScript.beingUsed = false;

                }
            }

            //if icon is store
            else if (iconType == 2)
            {
                if(objectPropertiesScript.storable == true)
                {
                    inventoryArray = iconHandlerScript.invArray;

                    for (int i = 0; i < inventoryArray.Length; i++)
                    {

                        if (inventoryArray[i].transform.childCount == 0)
                        {
                            linkedObject.transform.position = new Vector3(inventoryArray[i].transform.position.x,
                                inventoryArray[i].transform.position.y, inventoryArray[i].transform.position.z - 0.5f);
                            linkedObject.transform.rotation = inventoryArray[i].transform.rotation;

                            linkedObject.transform.parent = inventoryArray[i].transform;
                            objectPropertiesScript.stored = true;
                            iconHandlerScript.beingUsed = false;
                            return;
                        }

                    }
                }

                iconHandlerScript.beingUsed = false;

            }

        }
    }
Ejemplo n.º 10
0
    void setNewTarget(GameObject newTarget, bool isTransition)
    {
        if (newTarget != null) {
            //if old target exists, and is a puzzle, disable it
            ObjectProperties newObjectProperties = newTarget.GetComponent<ObjectProperties>();
            if(newObjectProperties != null && newObjectProperties.customCamera != null)
            {
                if(target != null && targetProperties != null && targetProperties.isPuzzle) {
                    target.SendMessage("EnablePuzzle", false);
                }

                //enabling old target collider and parent s, as long as it is NOT a parent of the new target
                if (target != null && !newTarget.transform.IsChildOf (target.transform)) {
                    //Second parameter is to enable just the object (false) or parents of obj too (true)
                    enableObjectAndParentColliders (target, !target.transform.IsChildOf (newTarget.transform));
                } else {
                    //when newtarget is child, then add the parent obj to the stack
                    parentStack.Push (target);
                }

                //Disabling new target collider to detect children colliders
                setObjectColliderEnabled (newTarget, false);

                //Setting new target to local var
                target = newTarget;
                targetProperties = newObjectProperties;

                //Setting global vars to new values
                toolbox.currentTargetProperties.setValuesFromProperties(targetProperties, newTarget.transform);

                if(isTransition)
                {
                    mainCamera.SetGameCamera(targetProperties.customCamera, targetProperties.transitionTime);
                    //Setting vars for zoom lerp
                    //zoomStartTime = Time.time;
                    //zoomStartPos = transform.localPosition;
                    //moveStartPos = cameraObj.transform.position;

                    toolbox.beginTransition();
                }else{
                    mainCamera.SetGameCamera(targetProperties.customCamera, 0);
                }

                //If the gameobject has a puzzle, call method to enable
                if(targetProperties.isPuzzle){

                    newTarget.SendMessage("EnablePuzzle", true);
                }
            }

        }
    }