protected virtual Bullet_motor instanciate() { Bullet_motor obj = singleton.object_pool.Ammo_pool.instance.pop(this); return(obj); }
protected virtual Bullet_motor instanciate(Vector3 position) { Bullet_motor obj = instanciate(); obj.transform.position = position; return(obj); }
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); }
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); } }
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); } }
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); }
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); }
protected virtual void move_to_container(Bullet_motor obj) { obj.transform.parent = container; obj.gameObject.SetActive(false); }
protected Ammo get_key(Bullet_motor value) { var motor = value.GetComponent <Bullet_motor>(); return(motor.ammo); }
public virtual void push(Bullet_motor bullet) { bullet.reset(); singleton.object_pool.Ammo_pool.instance.push(bullet); }