コード例 #1
0
        public CheckForCollision_BlueprintData(CheckForCollisionCondition condition)
        {
            this.name = condition.transform.name;

            this.position = condition.transform.localPosition;
            this.rotation = condition.transform.localRotation;
            this.scale    = condition.transform.localScale;

            this.allowedTags = condition.allowedTags;

            BoxCollider collider = condition.GetComponent <BoxCollider>();

            if (collider != null)
            {
                this.ceneter = collider.center;
                this.size    = collider.size;
            }
        }
コード例 #2
0
        public override void UnPack(GameObject target)
        {
            BaseBuilding building = target.GetComponentInParent <BaseBuilding>();

            if (building != null)
            {
                CheckForCollisionCondition condition = (CheckForCollisionCondition)building.CreateCondition(name, SocketPositionAnchor.Center, typeof(CheckForCollisionCondition));

                BoxCollider collider = condition.GetComponent <BoxCollider>();

                if (collider != null)
                {
                    collider.center = (Vector3)this.ceneter;
                    collider.size   = (Vector3)this.size;
                }

                condition.transform.localPosition = (Vector3)position;
                condition.transform.localScale    = (Vector3)scale;
                condition.transform.localRotation = (Quaternion)rotation;

                condition.allowedTags = this.allowedTags;
            }
        }