コード例 #1
0
        protected void Start()
        {
            GameObject base_prefab = null;

            if (Element is Atrezzo)
            {
                base_prefab = Atrezzo_Prefab;
            }
            if (Element is NPC)
            {
                base_prefab = Character_Prefab;
            }
            if (Element is Item)
            {
                base_prefab = Object_Prefab;
            }

            var context = new ElementReference(Reference.getTargetId(), 0, 0);

            if (base_prefab != null)
            {
                GameObject ret = GameObject.Instantiate(base_prefab);
                mb         = ret.GetComponent <Representable>();
                mb.Context = context;
                mb.Element = Element;
                ret.transform.SetParent(transform);
                ret.transform.localPosition = Vector3.zero;
            }

            transformManager         = ExtElemReferenceTransformManagerFactory.Instance.CreateInstance(Reference.TransformManagerDescriptor, Reference.TransformManagerParameters);
            transformManager.Context = context;
            transformManager.ExtElemReferenceTransform = this.transform;
            transformManager.Update();
        }
コード例 #2
0
    public static Representation Create(Representable master, GameObject prefab, Vector2 position, Vector3 eulerRotation)
    {
        GameObject     instance = Instantiate(prefab, new Vector3(position.x, position.y, 0f), Quaternion.Euler(eulerRotation)) as GameObject;
        Representation slave    = instance.GetComponent <Representation>();

        slave.master = master;

        return(slave);
    }
コード例 #3
0
    protected override void Awake()
    {
        base.Awake();

        representable = GetComponent <Representable>();
    }