Пример #1
0
            protected virtual Bullet_motor instanciate()
            {
                Bullet_motor obj =
                    singleton.object_pool.Ammo_pool.instance.pop(this);

                return(obj);
            }
Пример #2
0
            protected virtual Bullet_motor instanciate(Vector3 position)
            {
                Bullet_motor obj = instanciate();

                obj.transform.position = position;
                return(obj);
            }
Пример #3
0
            public virtual Bullet_motor instanciate(
                Vector3 position, rol_sheet.Rol_sheet owner)
            {
                Bullet_motor obj        = instanciate(position);
                var          controller = obj.GetComponent <
                    chibi.controller.weapon.gun.bullet.Controller_bullet>();
                var damages = controller.damages;

                foreach (var damage in damages)
                {
                    damage.owner = owner;
                }
                return(obj);
            }
Пример #4
0
            public virtual void push(Bullet_motor value)
            {
                Ammo key = get_key(value);

                move_to_container(value);
                if (_dict.ContainsKey(key))
                {
                    _dict[key].Push(value);
                }
                else
                {
                    Stack <Bullet_motor> stack_tmp =
                        new Stack <Bullet_motor>();
                    stack_tmp.Push(value);
                    _dict.Add(key, stack_tmp);
                }
            }
Пример #5
0
            public Bullet_motor instantiate(Ammo key)
            {
                var prefab = key.prefab_bullet;

                if (prefab == null)
                {
                    Debug.Log(string.Format(
                                  "el Ammo ( '{0}' ) no tiene prefab defino", key.name));
                    return(null);
                }
                else
                {
                    Bullet_motor obj = helper.instantiate._(prefab);
                    obj.ammo = key;
                    return(obj);
                }
            }
Пример #6
0
            public virtual Bullet_motor instanciate(
                Vector3 position, chibi.rol_sheet.Rol_sheet owner)
            {
                Bullet_motor obj        = instanciate(position);
                var          controller = obj.GetComponent <Controller_bullet>();
                var          motor      = obj.GetComponent <Bullet_motor>();

                motor.enabled = false;

                var damages = controller.damages;

                foreach (var damage in damages)
                {
                    damage.owner = owner;
                }
                return(obj);
            }
Пример #7
0
            public virtual Bullet_motor pop(Ammo key)
            {
                Bullet_motor result = null;

                if (_dict.ContainsKey(key))
                {
                    var stack = _dict[key];
                    if (stack.Count > 0)
                    {
                        result = stack.Pop();
                    }
                }
                if (result == null)
                {
                    // result = helper.instantiate.inactive._( key );
                    result = instantiate(key);
                }
                else
                {
                    result.transform.parent = null;
                }
                return(result);
            }
Пример #8
0
 protected virtual void move_to_container(Bullet_motor obj)
 {
     obj.transform.parent = container;
     obj.gameObject.SetActive(false);
 }
Пример #9
0
            protected Ammo get_key(Bullet_motor value)
            {
                var motor = value.GetComponent <Bullet_motor>();

                return(motor.ammo);
            }
Пример #10
0
 public virtual void push(Bullet_motor bullet)
 {
     bullet.reset();
     singleton.object_pool.Ammo_pool.instance.push(bullet);
 }