public static LVector2 GetHeadPos(LVector2 pos, EDir dir)
        {
            var dirVec      = DirUtil.GetDirLVec(dir);
            var fTargetHead = pos + (TANK_HALF_LEN + FORWARD_HEAD_DIST) * dirVec;

            return(fTargetHead);
        }
        public static LVector2 GetHeadPos(LVector2 pos, EDir dir, LFloat len)
        {
            var dirVec      = DirUtil.GetDirLVec(dir);
            var fTargetHead = pos + (TANK_HALF_LEN + len) * dirVec;

            return(fTargetHead);
        }
        public void CreateBullet(LVector2 pos, EDir dir, int type, IEntity pEntity){
            var owner = pEntity as GameEntity;
            var createPos = pos + DirUtil.GetDirLVec(dir) * TankUtil.TANK_HALF_LEN;

            var entity = CreateUnit(createPos, _gameConfigService.bulletPrefabs, type, dir);
            entity.bullet.ownerLocalId = owner.localId.value;
            entity.unit.camp = owner.unit.camp;
        }
        public void CreateBullet(LVector2 pos, EDir dir, int type, GameEntity owner)
        {
            var createPos = pos.Floor().ToLVector2() + DirUtil.GetDirLVec(dir) + TankUtil.UNIT_SIZE;
            var entity    = CreateUnit(createPos, _config.bulletPrefabs, type, dir, transParentBullet);

            entity.owner.localId = owner.localId.value;
            entity.unit.camp     = owner.unit.camp;
        }
        public void CreateBullet(LVector2 pos, EDir dir, int type, GameEntity owner)
        {
            var createPos = pos + DirUtil.GetDirLVec(dir) * TankUtil.TANK_HALF_LEN;

            var entity = CreateUnit(createPos, _config.bulletPrefabs, type, dir, transParentBullet);

            entity.bullet.ownerLocalId = owner.localId.value;
            entity.unit.camp           = owner.unit.camp;
        }
Exemple #6
0
        public void CreateBullet(LVector2 pos, EDir dir, ushort type, IEntity pEntity)
        {
            var owner     = pEntity as GameEntity;
            var createPos = pos + DirUtil.GetDirLVec(dir) * TankUtil.TANK_HALF_LEN;
            var entity    = CreateUnit(createPos, EntityUtil.CreateEntityBullet(_gameContext, type), dir);

            entity.bullet.ownerLocalId = owner.entityId.value;
            entity.unit.camp           = owner.unit.camp;
            entity.collider.radius     = new LFloat(null, 300);
            entity.collider.size       = LVector2.zero;
        }