Beispiel #1
0
        public void DefaultConstructor_ExpectedValues()
        {
            // Call
            var properties = new ObjectProperties <string>();

            // Assert
            Assert.IsInstanceOf <IObjectProperties>(properties);
            Assert.IsNull(properties.Data);
        }
Beispiel #2
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();
     }
 }
Beispiel #3
0
 public static void Write(this ObjectProperties objectProperties, CSideWriter writer)
 {
     writer.BeginSection("OBJECT-PROPERTIES");
     writer.WriteLineIf(objectProperties.DateTime.HasValue, "Date={0};", objectProperties.DateTime.ToShortDateString());
     writer.WriteLineIf(objectProperties.DateTime.HasValue, "Time={0};", objectProperties.DateTime.ToShortTimeString());
     writer.WriteLineIf(objectProperties.Modified, "Modified=Yes;");
     writer.WriteLineIf(objectProperties.VersionList != null, "Version List={0};", objectProperties.VersionList);
     writer.EndSection();
 }
Beispiel #4
0
        //
        //
        // Get property
        //
        public Encodable getProperty(PropertyIdentifier pid)
        {
            if (pid.Value == PropertyIdentifier.ObjectIdentifier.Value)
            {
                return(Id);
            }
            if (pid.Value == PropertyIdentifier.ObjectType.Value)
            {
                return(Id.ObjectType);
            }

            // Check that the requested property is valid for the object. This will throw an exception if the
            // property doesn't belong.
            ObjectProperties.getPropertyTypeDefinitionRequired(Id.ObjectType, pid);

            // Do some property-specific checking here.
            if (pid.Value == PropertyIdentifier.LocalTime.Value)
            {
                return(new Time());
            }
            if (pid.Value == PropertyIdentifier.LocalDate.Value)
            {
                return(new Date());
            }

            // AdK - COV subscriptions
            if (pid.Value == PropertyIdentifier.ActiveCovSubscriptions.Value)
            {
                IList      objs = localDevice.LocalObjects;
                SequenceOf covS = new SequenceOf(); // CovSubscriptions

                foreach (BACnetObject obj in objs)
                {
                    foreach (ObjectCovSubscription s in obj.covSubscriptions)
                    {
                        RemoteDevice d = localDevice.getRemoteDevice(s.Address);
                        Recipient    r = null;
                        if (d != null)
                        {
                            r = new Recipient(d.ObjectIdentifier);
                        }
                        else
                        {
                            r = new Recipient(s.Address);
                        }
                        covS.add(new CovSubscription(new RecipientProcess(r, s.SubscriberProcessIdentifier),
                                                     new ObjectPropertyReference(obj.Id, PropertyIdentifier.PresentValue),
                                                     new BBoolean(s.IsIssueConfirmedNotifications),
                                                     new UnsignedInteger(s.GetTimeRemaining(System.DateTime.Now.Ticks)), obj.getCovIncrement()
                                                     ));
                    }
                }
                return(covS);
            }

            return((Encodable)properties[pid]);
        }
Beispiel #5
0
        /// <summary>Adds the game pad converters for the sliders / triggers</summary>
        private void addSliderConverters()
        {
            IList <DeviceObjectInstance> axes = this.joystick.GetObjects(
                ObjectDeviceType.AbsoluteAxis
                );

            int sliderCount = countInstances(axes, ObjectGuid.Slider);

            if (sliderCount < 2)
            {
                // Less than two sliders but an Rz axis? Rz axis is left trigger.
                if (countInstances(axes, ObjectGuid.RotationalZAxis) > 0)
                {
                    int id = (int)getInstance(axes, ObjectGuid.RotationalZAxis, 0).ObjectType;
                    ObjectProperties properties = this.joystick.GetObjectPropertiesById(id);
                    convertDelegate += new RotationalZAxisLeftTriggerConverter(
                        properties.LowerRange, properties.UpperRange
                        ).Convert;

                    // Rz axis plus one real slider? Make it the right trigger.
                    if (sliderCount > 0)
                    {
                        id               = (int)getInstance(axes, ObjectGuid.Slider, 0).ObjectType;
                        properties       = this.joystick.GetObjectPropertiesById(id);
                        convertDelegate += new SliderRightTriggerConverter(
                            0, properties.LowerRange, properties.UpperRange
                            ).Convert;
                    }
                }
                else if (sliderCount > 0) // No Rz axis, only one slider. It's the left trigger.

                {
                    int id = (int)getInstance(axes, ObjectGuid.Slider, 0).ObjectType;
                    ObjectProperties properties = this.joystick.GetObjectPropertiesById(id);
                    convertDelegate += new SliderLeftTriggerConverter(
                        0, properties.LowerRange, properties.UpperRange
                        ).Convert;
                }
            }

            // Two sliders? Make them the left and right triggers.
            if (sliderCount >= 2)
            {
                int id = (int)getInstance(axes, ObjectGuid.Slider, 0).ObjectType;
                ObjectProperties properties = this.joystick.GetObjectPropertiesById(id);
                convertDelegate += new SliderLeftTriggerConverter(
                    0, properties.LowerRange, properties.UpperRange
                    ).Convert;

                id               = (int)getInstance(axes, ObjectGuid.Slider, 1).ObjectType;
                properties       = this.joystick.GetObjectPropertiesById(id);
                convertDelegate += new SliderLeftTriggerConverter(
                    1, properties.LowerRange, properties.UpperRange
                    ).Convert;
            }
        }
Beispiel #6
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();
     }
 }
Beispiel #7
0
        public void removeProperty(PropertyIdentifier pid)
        {
            PropertyTypeDefinition def = ObjectProperties.getPropertyTypeDefinitionRequired(Id.ObjectType, pid);

            if (def.IsRequired)
            {
                throw new BACnetServiceException(ErrorClass.Property, ErrorCode.WriteAccessDenied);
            }
            properties.Remove(pid);
        }
    /// <inheritdoc/>
    public void Duplicate(ObjectProperties objectProperties)
    {
        CubeProperties cubeProperties = (CubeProperties)objectProperties;

        this.color = cubeProperties.color;

        CubeUI cui = FindObjectOfType(typeof(CubeUI)) as CubeUI;

        cui.Setup(gameObject, this.color);
    }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                ObjectProperties?.Dispose();
                components?.Dispose();
            }

            base.Dispose(disposing);
        }
Beispiel #10
0
 public ObjectProperties PopObject()
 {
     if (objectList.Count > 0)
     {
         ObjectProperties temp = objectList[0];
         objectList.RemoveAt(0);
         return(temp);
     }
     return(null);
 }
Beispiel #11
0
        public override ObjectProperties Properties()
        {
            var props = new ObjectProperties();

            foreach (var attr in node.Attributes)
            {
                props.Add(attr.Name, new ObjectResult(attr.NodeValue), null);
            }

            return(props);
        }
Beispiel #12
0
 private void ReleasePickedUpItem(Vector3 forceDirection = new Vector3())
 {
     _pickedUpItem.transform.SetParent(null);
     _pickedUpItem.gameObject.GetComponent <Rigidbody>().isKinematic = false;
     if (forceDirection != default(Vector3))
     {
         _pickedUpItem.gameObject.GetComponent <Rigidbody>().AddForce(forceDirection * (_intitialThrowStrength * _strength) + (GetComponent <Rigidbody>().velocity * 20)); // TODO variable throw based on strength
     }
     _pickedUpItem.OnDropped(this);
     _pickedUpItem = null;
 }
Beispiel #13
0
 public void AddObject(ObjectProperties placedObject)
 {
     if (objectList.Contains(placedObject))
     {
         Debug.Log("Don't add same object again");
     }
     else
     {
         objectList.Add(placedObject);
     }
 }
Beispiel #14
0
 /*
  * Check if there is an object stored in the targetObject variable
  * Check if it has an ObjectProperties component to apply damage to
  * Apply Damage if both of these confitions are met
  *
  * Negative values deal damage, positive values heal
  */
 public void ApplyTargetHealthChange(float healthChange)
 {
     if (targetObject != null)
     {
         ObjectProperties targetProperties = targetObject.GetComponent <ObjectProperties>();
         if (targetProperties != null)
         {
             targetProperties.AddHealth(healthChange);
         }
     }
 }
Beispiel #15
0
        protected static SequenceOf readSequenceOfEncodable(ByteStream source, ObjectType objectType,
                                                            PropertyIdentifier propertyIdentifier, int contextId)
        {
            PropertyTypeDefinition def = ObjectProperties.getPropertyTypeDefinition(objectType, propertyIdentifier);

            if (def == null)
            {
                return(readSequenceOf(source, typeof(AmbiguousValue), contextId));
            }
            return(readSequenceOf(source, def.Type, contextId));
        }
Beispiel #16
0
 public void AddToFollowers(ObjectProperties item)
 {
     if (followers == null)
     {
         followers = new List <ObjectProperties>();
     }
     if (!followers.Contains(item))
     {
         followers.Add(item);
     }
 }
Beispiel #17
0
        //
        //
        // Set property
        //
        public void setProperty(PropertyIdentifier pid, Encodable value)
        {
            ObjectProperties.validateValue(Id.ObjectType, pid, value);
            setPropertyImpl(pid, value);

            // If the relinquish default was set, make sure the present value gets updated as necessary.
            if (pid.Equals(PropertyIdentifier.RelinquishDefault))
            {
                setCommandableImpl((PriorityArray)getProperty(PropertyIdentifier.PriorityArray));
            }
        }
Beispiel #18
0
        public void Data_SetValue_GetNewlySetValue()
        {
            // Setup
            var          properties = new ObjectProperties <string>();
            const string text       = "text";

            // Call
            properties.Data = text;

            // Assert
            Assert.AreEqual(text, properties.Data);
        }
Beispiel #19
0
        public void Quantity()
        {
            var chartKey             = CreateTestChart();
            var evnt                 = Client.Events.Create(chartKey);
            ObjectProperties object1 = new ObjectProperties("GA1", 5);

            Client.Events.ChangeObjectStatus(evnt.Key, new[] { object1 }, "foo");

            var objectInfo1 = Client.Events.RetrieveObjectInfo(evnt.Key, "GA1");

            Assert.Equal(5, objectInfo1.NumBooked);
        }
    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;
        }
    }
Beispiel #21
0
        public void setProperty(PropertyIdentifier pid, uint indexBase1, Encodable value)
        {
            ObjectProperties.validateSequenceValue(Id.ObjectType, pid, value);
            SequenceOf list = (SequenceOf)properties[pid];

            if (list == null)
            {
                list = new SequenceOf();
                setPropertyImpl(pid, list);
            }
            list.set((int)indexBase1, value);
        }
 private void grdPropVal_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (sender != null)
     {
         DataGrid grid = sender as DataGrid;
         if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1)
         {
             ObjectProperties objProp = (ObjectProperties)grid.SelectedItem;
             //objProp.Name
             LoadProperties(objProp.value);
         }
     }
 }
Beispiel #23
0
        public void validate()
        {
            // Ensure that all required properties have values.
            IList defs = ObjectProperties.getRequiredPropertyTypeDefinitions(Id.ObjectType);

            foreach (PropertyTypeDefinition def in defs)
            {
                if (getProperty(def.PropertyIdentifier) == null)
                {
                    throw new BACnetServiceException(ErrorClass.Property, ErrorCode.Other, "Required property not set: " + def.PropertyIdentifier);
                }
            }
        }
        public bool Run()
        {
            m_Log.Info("Putting test data into ObjectProperties");
            ObjectProperties propMsg = new ObjectProperties();

            propMsg.ObjectData.Add(testData);
            UDPPacket p = new UDPPacket(4096, true);

            propMsg.Serialize(p);
            p.Flush();
            m_Log.InfoFormat("Serialized length={0}", p.DataLength);
            return(p.DataLength == 118);
        }
 private void listEnemies_DoubleClick(object sender, EventArgs e)
 {
     if (listEnemies.SelectedItem != null)
     {
         if (listBoxObjectsToCreate.SelectedItem != null)
         {
             if (listBoxObjectsToCreate.SelectedItem is EnemyDescription)
             {
                 ((EnemyDescription)listBoxObjectsToCreate.SelectedItem).Type = listEnemies.SelectedItem.ToString();
             }
         }
     }
     ObjectProperties.Refresh();
 }
Beispiel #26
0
 /// <summary>
 /// Set min,max,saturation and deadzone to axis
 /// </summary>
 /// <param name="axis"></param>
 /// <param name="propertieAxis"></param>
 private void setAxiskValue(ObjectProperties axis, axis propertieAxis)
 {
     try
     {
         /* Loopa igenom alla axlar */
         axis.SetRange(propertieAxis.min, propertieAxis.max);
         axis.DeadZone   = propertieAxis.deadZone;
         axis.Saturation = propertieAxis.saturation;
     }
     catch
     {
         log("setAxiskValue", "Axis " + axis.ToString() + " does not exist");
     }
 }
Beispiel #27
0
 /// <summary>
 /// Set the properties that are set in an ObjectPropertiesFamily packet
 /// </summary>
 /// <param name="props"><seealso cref="ObjectProperties"/> that has
 /// been partially filled by an ObjectPropertiesFamily packet</param>
 public void SetFamilyProperties(ObjectProperties props)
 {
     ObjectID      = props.ObjectID;
     OwnerID       = props.OwnerID;
     GroupID       = props.GroupID;
     Permissions   = props.Permissions;
     OwnershipCost = props.OwnershipCost;
     SaleType      = props.SaleType;
     SalePrice     = props.SalePrice;
     Category      = props.Category;
     LastOwnerID   = props.LastOwnerID;
     Name          = props.Name;
     Description   = props.Description;
 }
        private Grid GetPropertyPage(ObjectProperties propertiesObject)
        {
            var propertiesContainer = PropertiesFactory.GetPropertiesContainer(propertiesObject);

            // create property page control
            var propertyPage = new PropertiesBar();

            // set properties to property page
            var propertiesControl = (IPropertiesControl)propertyPage;

            propertiesControl.SetProperties(propertiesContainer);

            return(propertyPage);
        }
Beispiel #29
0
    private void PickupOrPushItem()
    {
        if (_pickedUpItem == null && _pushItem == null)
        {
            if (_interactionTrigger.PickupObjectsAvailable.Count > 0)
            {
                //TODO depends on whcih item is closest to the centre of the trigger
                _pickedUpItem = _interactionTrigger.PickupObjectsAvailable[0];
            }
            else if (_interactionTrigger.PushObjectsAvailable.Count > 0)
            {
                _pushItem = _interactionTrigger.PushObjectsAvailable[0];
            }

            if (_pickedUpItem != null)
            {
                _pickedUpItem.gameObject.GetComponent <Rigidbody>().isKinematic = true;
                //TODO set _pickedUpItemSlot position high enough that it can carry any item variable on the size of the thing you're picking up
                //_pickedUpItemSlot.position = gameObject.transform.position + new Vector3(0, (_pickedUpItem.GetComponent<Collider>().bounds.size.y * 1.1f) + 0.5f, 0);
                _pickedUpItem.transform.SetParent(gameObject.transform);
                _pickedUpItem.OnPickedUp(this);
                _audioPickup.Play();
            }
            else if (_pushItem != null)
            {
                if (_pushItem is Cannon)
                {
                    _currentTurnRate = _baseTurnRate * 0.1f;
                    _speed           = _startingSpeed * 0.5f;
                }
                _pushItem.transform.position += new Vector3(0, 0.35f, 0);
                _pushItemSlot.position        = _pushItem.transform.position + (gameObject.transform.forward * 1);
                var rb = _pushItem.gameObject.GetComponent <Rigidbody>();
                rb.isKinematic = true;
                //var collider = _pushItem.gameObject.GetComponent<Collider>();
                //collider.isTrigger = true;
            }
        }
        else
        {
            if (_pickedUpItem != null)
            {
                ReleasePickedUpItem();
            }
            else
            {
                ReleasePushedItem();
            }
        }
    }
Beispiel #30
0
        public static void Write(this ObjectProperties objectProperties, CSideWriter writer)
        {
            writer.BeginSection("OBJECT-PROPERTIES");
            var dateFieldName        = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Date");
            var timeFieldName        = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Time");
            var modifiedFieldName    = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Modified");
            var versionListFieldName = writer.CodeStyle.CustomPropertyMappings.GetDisplayName("Version List");

            writer.WriteLineIf(objectProperties.DateTime.HasValue, "{1}={0};", objectProperties.HasDateComponent? objectProperties.DateTime.ToShortDateString(writer.CodeStyle.Localization) : "", dateFieldName);
            writer.WriteLineIf(objectProperties.DateTime.HasValue, "{1}={0};", objectProperties.HasTimeComponent? objectProperties.DateTime.ToShortTimeString(writer.CodeStyle.Localization, writer.CodeStyle.UseEnclosedTimeFormat) : "", timeFieldName);
            writer.WriteLineIf(objectProperties.Modified, "{1}={0};", writer.CodeStyle.Localization.ConvertBoolToString(true), modifiedFieldName);
            writer.WriteLineIf(objectProperties.VersionList != null, "{1}={0};", objectProperties.VersionList, versionListFieldName);
            writer.EndSection();
        }
Beispiel #31
0
        public bool Init(byte[] buffer, AbbreviationTable abbreviationTable)
        {
            int len   = GetByte(buffer, Header);
            int index = Header + 1;

            // load object name
            if (len > 0)
            {
                Text t = new Text();

                for (int i = 0; i < len; i++)
                {
                    t.AddCharacters(GetWord(buffer, index));
                    index += 2;
                }

                Name = t.GetValue(abbreviationTable);
            }

            int x = GetByte(buffer, index);

            // load object properties
            while (x != 0)
            {
                List <int> list          = new List <int>();
                int        id            = x & 0x1f;
                int        numberOfBytes = (x >> 5) + 1;

                ObjectProperties.Add(id, new ObjectProperty()
                {
                    //TODO Verify Address
                    Address = index + 1,
                    Index   = id
                });

                for (int i = 0; i < numberOfBytes; i++)
                {
                    list.Add(GetByte(buffer, ++index));
                }

                ObjectProperties[id].List = list;

                x = GetByte(buffer, ++index);
            }

            LoadAttributes();

            return(true);
        }
    public void LayoutObjectAtRandom(GameObject[] arrayOfObjects, Types typeOfObject)
    {
        if (arrayOfObjects != null)
        {
            objProp = arrayOfObjects[0].GetComponent <ObjectProperties>();

            int incidence = objProp.incidenceNumber;
            Debug.Log("incidence: " + incidence);
            int calculatedAmount = CalculateAmount(incidence);

            //  Set correct amount of objects into the world
            for (int i = 0; i < calculatedAmount; i++)
            {
                Vector3 randomPosition = RandomPosition();
                int     rotation;
                float   height;

                if (typeOfObject == Types.TREE)
                {
                    rotation = -90;
                    height   = 0.5f;
                }
                else if (typeOfObject == Types.GRASS)
                {
                    rotation = 0;
                    height   = 0f;
                }
                else if (typeOfObject == Types.ROCK)
                {
                    rotation = 90;
                    height   = 0.1f;
                }
                else
                {
                    rotation = 0;
                    height   = 0f;
                }

                GameObject choosedObject = arrayOfObjects[Random.Range(0, arrayOfObjects.Length)];
                GameObject toInstantiate = Instantiate(choosedObject, randomPosition, Quaternion.Euler(rotation, 0, 0)) as GameObject;
                toInstantiate.transform.localPosition = new Vector3(toInstantiate.transform.position.x, height, toInstantiate.transform.position.z);
                toInstantiate.transform.SetParent(worldHolder);
            }
        }
        else
        {
            Debug.Log("arrayOfObjects is null");
        }
    }
Beispiel #33
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>());
        }
    }
Beispiel #34
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;

            }

        }
    }
Beispiel #35
0
 // Use this for initialization
 void Start()
 {
     // set the script objects
     objectPropertiesScript = this.GetComponent<ObjectProperties>();
     iconHandlerScript = GameObject.Find("IconHandler").GetComponent<IconHandler>();
 }
Beispiel #36
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);
			}
Beispiel #37
0
 public void AddToFollowers(ObjectProperties item)
 {
     if (followers == null) followers = new List<ObjectProperties>();
     if (!followers.Contains(item)) followers.Add(item);
 }
Beispiel #38
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;
        }
 // Use this for initialization
 void Start()
 {
     properties = GetComponent(typeof(ObjectProperties)) as ObjectProperties;
     timeSinceMove = 1;
 }
    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);
                }
            }

        }
    }