Exemple #1
0
        protected internal override void OnAttachTo(EntityBase parentEntity, Transform parentTransform, object userData)
        {
            base.OnAttachTo(parentEntity, parentTransform, userData);
            gameObject.SetLayerRecursively(SelfTransform.parent.gameObject.layer);

            SelfTransform.RestTransform();
        }
Exemple #2
0
        /**
         * If a player is in range, enemy will start spawning.
         * @param call: pass in your StartCoroutin of CustomStartCoroutin function.
         */
        public void SpawnInRange(System.Func <IEnumerator, Coroutine> call)
        {
            var local     = SelfTransform.TransformPoint(Position);
            var colliders = Physics2D.OverlapCircleAll(local, Radius);

            for (var i = 0; i < colliders.Length; i++)
            {
                var obj = colliders[i];

                if (obj.gameObject.CompareTag(Player))
                {
                    call(Spawn());
                    Used = true;
                    break;
                }
            }
        }
Exemple #3
0
        protected internal override void OnAttachTo(EntityBase parentEntity, Transform parentTransform, object userData)
        {
            base.OnAttachTo(parentEntity, parentTransform, userData);

            SelfTransform.RestTransform();
        }
 private void Awake()
 {
     base.Awake();
     UIRoot = SelfTransform.Find(mUIRootStr);
 }
Exemple #5
0
 /// <summary>
 /// 实体解除子实体(子物体触发)
 /// </summary>
 /// <param name="parentEntity">被解除的父实体</param>
 /// <param name="userData">用户自定义数据</param>
 protected internal override void OnDetachFrom(EntityBase parentEntity, object userData)
 {
     base.OnDetachFrom(parentEntity, userData);
     SelfTransform.SetParent(m_OriginalTransform);
 }